The man page for freopen should describe the behavior if the "path" argument is NULL, i.e. that if "path" is NULL then freopen tries to reopen the file associated with the "stream" argument. I think this was added in C99. If it doesn't work in C89 then it would also be good to mention that.
Hello Helmut, I added the following text to the page: If the path argument is a null pointer, freopen() changes the mode of the stream to that specified in mode; that is, freopen() reopens the pathname that is associated with the stream. The specification for this behavior was added in the C99 standard, which says: In this case, the file descriptor associated with the stream need not be closed if the call to freopen() suc‐ ceeds. It is implementation-defined which changes of mode are permitted (if any), and under what circumstances. I'll close this bug now. Please reopen if you think anything more is required. Cheers, Michael