I'm not sure I see much point in this but do it if you like. It will
potentially close STDIN_FILENO though, I think that is harmless at the
moment - or perhaps prepare_input should dup() it.



On Sat, Jul 01, 2017 at 03:26:27PM -0400, Bryan Steele wrote:
> I think I lost this part in my larger diff, make sure fds are closed
> after testing files.
> 
> -Bryan.
> 
> Index: file.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/file/file.c,v
> retrieving revision 1.63
> diff -u -p -u -r1.63 file.c
> --- file.c    28 Jun 2017 17:14:15 -0000      1.63
> +++ file.c    1 Jul 2017 19:23:17 -0000
> @@ -208,6 +208,8 @@ main(int argc, char **argv)
>       for (idx = 0; idx < argc; idx++) {
>               inf[idx].m = m;
>               test_file(&inf[idx], width);
> +             if (inf[idx].fd != -1)
> +                     close(inf[idx].fd);
>       }
>       exit(0);
>  }
> 

Reply via email to