summaryrefslogtreecommitdiffstats
path: root/usr.bin/truncate
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>2000-07-23 13:24:01 +0000
committersheldonh <sheldonh@FreeBSD.org>2000-07-23 13:24:01 +0000
commit2ae5c3dffce3ca0150eb28e8e2e79b27183490c4 (patch)
treeb1b4e15305ef62dc600ff90f6a0d345bd7f65f1d /usr.bin/truncate
parentf55c1c6732287426a3138679c42c18109a6fb584 (diff)
downloadFreeBSD-src-2ae5c3dffce3ca0150eb28e8e2e79b27183490c4.zip
FreeBSD-src-2ae5c3dffce3ca0150eb28e8e2e79b27183490c4.tar.gz
Close file descriptors after use so as not to abuse the descriptor
table when a long argument list is given. :-) Reported by: Sven Agnew <afterhours80@hotmail.com>
Diffstat (limited to 'usr.bin/truncate')
-rw-r--r--usr.bin/truncate/truncate.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/truncate/truncate.c b/usr.bin/truncate/truncate.c
index 0b6fef4..86c92f4 100644
--- a/usr.bin/truncate/truncate.c
+++ b/usr.bin/truncate/truncate.c
@@ -135,6 +135,8 @@ main(int argc, char **argv)
error++;
continue;
}
+
+ close(fd);
}
return error ? EXIT_FAILURE : EXIT_SUCCESS;
OpenPOWER on IntegriCloud