This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug stdio/21398] freopen does not check dup3 return value, and does not return error if dup3 fails (seen when open returns fd 0, and freopen on stdin)
- From: "fweimer at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 19 Apr 2017 09:43:47 +0000
- Subject: [Bug stdio/21398] freopen does not check dup3 return value, and does not return error if dup3 fails (seen when open returns fd 0, and freopen on stdin)
- Auto-submitted: auto-generated
- References: <bug-21398-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=21398
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fweimer at redhat dot com
--- Comment #2 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Andreas Schwab from comment #1)
> I don't think using a stream where the underlying file descriptor is closed
> has defined behviour.
This conflicts with previous guidance I got. Applications are supposed to be
able to close descriptors used by the library (which is why we can't keep open
a descriptor for /dev/urandom, for example). Given this, it appears to be
reasonable to expect that it is possible to resurrect a stream using freopen if
its underlying descriptor has been closed.
--
You are receiving this mail because:
You are on the CC list for the bug.