diff options
author | Bryan Steele <brynet@cvs.openbsd.org> | 2017-07-01 21:07:14 +0000 |
---|---|---|
committer | Bryan Steele <brynet@cvs.openbsd.org> | 2017-07-01 21:07:14 +0000 |
commit | 6b97d35e8bf91fabdba1e5af71c26c9e097d9ebd (patch) | |
tree | 7988fab615993ffdc50383fc06da3a48f5835dc0 /usr.bin | |
parent | 6a53fc145d153ecd66f051140bfec37034967992 (diff) |
close open fd after testing files, ensuring that fd isn't stdin.
ok nicm@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/file/file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/file/file.c b/usr.bin/file/file.c index bd1cddd29fe..b98643dfe3d 100644 --- a/usr.bin/file/file.c +++ b/usr.bin/file/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.63 2017/06/28 17:14:15 brynet Exp $ */ +/* $OpenBSD: file.c,v 1.64 2017/07/01 21:07:13 brynet Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org> @@ -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 && inf[idx].fd != STDIN_FILENO) + close(inf[idx].fd); } exit(0); } |