summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-04-20 00:19:04 +0000
committerngie <ngie@FreeBSD.org>2016-04-20 00:19:04 +0000
commitc812be13956348789ee902dfa962354ef4cfe6ba (patch)
tree18cdd07180043b3350d52eeea0565553b3877a4c /lib
parentef837f8229b78347a7fa76948f495fc09df2ec2e (diff)
downloadFreeBSD-src-c812be13956348789ee902dfa962354ef4cfe6ba.zip
FreeBSD-src-c812be13956348789ee902dfa962354ef4cfe6ba.tar.gz
Fix double fclose of `fp1` when freopen fails
freopen handles closing file descriptors on error, with the exception of fdopen'ed descriptors, so closing an already fclose'd file descriptor is incorrect CID: 1338525 Differential Revision: https://reviews.freebsd.org/D6013 MFC after: 2 weeks Reported by: Coverity Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/tests/stdio/freopen_test.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/lib/libc/tests/stdio/freopen_test.c b/lib/libc/tests/stdio/freopen_test.c
index 1719927..8ca4719 100644
--- a/lib/libc/tests/stdio/freopen_test.c
+++ b/lib/libc/tests/stdio/freopen_test.c
@@ -48,7 +48,6 @@ runtest(const char *fname1, const char *mode1, const char *fname2,
"fopen(\"%s\", \"%s\") failed; errno=%d", fname1, mode1, errno);
fp2 = freopen(fname2, mode2, fp1);
if (fp2 == NULL) {
- fclose(fp1);
ATF_REQUIRE_MSG(success == false,
"freopen(\"%s\", \"%s\", fopen(\"%s\", \"%s\")) succeeded "
"unexpectedly", fname2_print, mode2, fname1, mode1);
OpenPOWER on IntegriCloud