[Bug stdio/15589] freopen would close oldfd even though oldfd is same as newfd

bugdal at aerifal dot cx sourceware-bugzilla@sourceware.org
Sat Nov 26 14:41:00 GMT 2016


https://sourceware.org/bugzilla/show_bug.cgi?id=15589

--- Comment #9 from Rich Felker <bugdal at aerifal dot cx> ---
It's most certainly nonsense to close the underlying fd for a stream then
perform any subsequent operations on the stream, but the situation could arise
as an implementation detail when a program is exec'd with the standard streams
closed. In that case, fd 0/1/2 may not be valid but the standard FILE objects
would reference them. I'm not sure whether this should be considered a valid
usage; arguably it's undefined to access the FILE objects in this case.
Alternatively, it's arguable that the implementation should detect this
condition at program start and lock out any access to the FILE objects.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list