This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]