Date: Wed, 20 Apr 2016 00:19:04 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298312 - head/lib/libc/tests/stdio Message-ID: <201604200019.u3K0J43L006669@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Wed Apr 20 00:19:04 2016 New Revision: 298312 URL: https://svnweb.freebsd.org/changeset/base/298312 Log: 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 Modified: head/lib/libc/tests/stdio/freopen_test.c Modified: head/lib/libc/tests/stdio/freopen_test.c ============================================================================== --- head/lib/libc/tests/stdio/freopen_test.c Tue Apr 19 23:59:10 2016 (r298311) +++ head/lib/libc/tests/stdio/freopen_test.c Wed Apr 20 00:19:04 2016 (r298312) @@ -48,7 +48,6 @@ runtest(const char *fname1, const char * "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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604200019.u3K0J43L006669>