On Tue, May 08, 2018 at 03:53:47AM +0000, Kyle Evans wrote:
> New Revision: 333351
> URL: https://svnweb.freebsd.org/changeset/base/333351
> 
> Log:
>   bsdgrep: Allow "-" to be passed to -f to mean "standard input"
>   
>   A version of this patch was originally sent to me by se@, matching behavior
>   from newer versions of GNU grep.
>  
> -     if ((f = fopen(fn, "r")) == NULL)
> +     if (strcmp(fn, "-") == 0)
> +             f = stdin;

This makes sense: when `fn' is "-", `f' is stdin.

> -     fclose(f);
> +     if (strcmp(fn, "-") != 0)
> +             fclose(f);

But not this one: why are you checking `fn' again?  Shouldn't you fclose(f)
if it's not stdin?

        if (f != stdin)
                fclose(f);

./danfe
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to