Page MenuHomeFreeBSD

Fix double fclose of `fp1` when freopen fails
ClosedPublic

Authored by ngie on Apr 19 2016, 11:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 28, 7:36 AM
Unknown Object (File)
Mon, Oct 28, 7:19 AM
Unknown Object (File)
Mon, Oct 28, 6:29 AM
Unknown Object (File)
Oct 20 2024, 7:02 PM
Unknown Object (File)
Sep 22 2024, 7:17 PM
Unknown Object (File)
Sep 22 2024, 9:11 AM
Unknown Object (File)
Sep 19 2024, 10:57 AM
Unknown Object (File)
Sep 18 2024, 7:27 PM

Details

Reviewers
markj
Summary

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
Reported by: Coverity
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

Test Plan

kyua test -k /usr/tests/lib/libc/stdio/Kyuafile freopen_test

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 3334
Build 3369: arc lint + arc unit

Event Timeline

ngie retitled this revision from to Fix double fclose of `fp1` when freopen fails.
ngie updated this object.
ngie edited the test plan for this revision. (Show Details)
ngie added subscribers: cem, jhb, jilles, markj.
markj added a reviewer: markj.

Seems like freopen(3) should probably indicate that fp will be closed even on error.

This revision is now accepted and ready to land.Apr 20 2016, 12:15 AM