This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Re: C99 freopen


That is not a reasonable approach.  I don't have the C99 spec so as to read
what its intent is supposed to be--but I find it hard to believe they
intended POSIX systems to introduce the one place where you can expect to
have the effect of determining a file name from a file descriptor (which in
the general case cannot be done).  The only thing that seems reasonable to
me is that this is expected only to work in the common case where
stdin/stdout/stderr are all copied from the same original descriptor on the
tty, that having been opened O_RDWR.  So, freopen's semantics would roughly
match those of fdopen(fileno(stream), newmode)--which is to say that
freopen can do the fcntl(F_GETFL) check on the requested new mode and tweak
the stream state to match the requested new mode, but that is all.


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