diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2017-01-05 15:45:01 +1300 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2017-01-05 15:45:01 +1300 |
| commit | 7eed8a8f10f00d19177b6f7b4665a87dff122068 (patch) | |
| tree | 7a1736e29ccc83fb36a75d651797a33e91d70c87 | |
| parent | a8250b9163f2b0ffab51de7bc0029494b671c3d6 (diff) | |
| download | man-pages-7eed8a8f10f00d19177b6f7b4665a87dff122068.tar.gz | |
fopen.3: Describe freopen() behavior for NULL pathname argument
See https://bugzilla.kernel.org/show_bug.cgi?id=191261
Reported-by: Helmut Eller <eller.helmut@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| -rw-r--r-- | man3/fopen.3 | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/man3/fopen.3 b/man3/fopen.3 index 12619976fd..20f94bcc5c 100644 --- a/man3/fopen.3 +++ b/man3/fopen.3 @@ -202,6 +202,28 @@ The argument is used just as in the .BR fopen () function. + +If the +.I path +argument is a null pointer, +.BR freopen () +changes the mode of the stream to that specified in +.IR mode ; +that is, +.BR freopen () +reopens the pathname that is associated with the stream. +The specification for this behavior was added in the C99 standard, which says: + +.RS +In this case, +the file descriptor associated with the stream need not be closed +if the call to +.BR freopen () +succeeds. +It is implementation-defined which changes of mode are permitted (if any), +and under what circumstances. +.RE +.PP The primary use of the .BR freopen () function is to change the file associated with a standard text stream |
