Hi,

> From: Maks Mishin <[email protected]>
>
> Signed-off-by: Maks Mishin <[email protected]>
> ---
>  editors/vi.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/editors/vi.c b/editors/vi.c
> index 2645afe..8dd45ef 100644
> --- a/editors/vi.c
> +++ b/editors/vi.c
> @@ -1990,6 +1990,9 @@ static int file_insert(const char *fn, char *p, int 
> initial)
>         if (p > end)
>                 p = end;
>
> +       if (fn == NULL)
> +               return cnt;
> +
>         fd = open(fn, O_RDONLY);
>         if (fd < 0) {
>                 if (!initial)
> --

With a NULL filename, open(3) returns -1 (and errno=EBADF), and that
is already checked after open(). So the check for NULL seems
redundant.

Cheers,

Xabier Oneca_,,_
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to