Bug 191261 - freopen with NULL as path argument
Summary: freopen with NULL as path argument
Status: RESOLVED CODE_FIX
Alias: None
Product: Documentation
Classification: Unclassified
Component: man-pages (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: documentation_man-pages@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-27 18:44 UTC by Helmut Eller
Modified: 2017-01-05 02:49 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Helmut Eller 2016-12-27 18:44:18 UTC
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.
Comment 1 Michael Kerrisk 2017-01-05 02:49:08 UTC
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

Note You need to log in before you can comment on or make changes to this bug.