summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/freopen.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2015-11-08 13:37:16 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2015-11-08 13:37:16 +0000
commit8ebe0f53597789057018d353c2b38b45470ea16e (patch)
tree20f498bd623fab85c76c978a69e059c9bda125d0 /lib/libc/stdio/freopen.c
parent70e3999d1cb81db14d8c144b945943879b103f42 (diff)
Notes
Diffstat (limited to 'lib/libc/stdio/freopen.c')
-rw-r--r--lib/libc/stdio/freopen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c
index bf3f0304a2ba..58227fa4b9de 100644
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -186,6 +186,7 @@ finish:
fp->_lb._size = 0;
fp->_orientation = 0;
memset(&fp->_mbstate, 0, sizeof(mbstate_t));
+ fp->_flags2 = 0;
if (f < 0) { /* did not get it after all */
if (isopen)
@@ -239,8 +240,10 @@ finish:
* we can do about this. (We could set __SAPP and check in
* fseek and ftell.)
*/
- if (oflags & O_APPEND)
+ if (oflags & O_APPEND) {
+ fp->_flags2 |= __S2OAP;
(void) _sseek(fp, (fpos_t)0, SEEK_END);
+ }
FUNLOCKFILE(fp);
return (fp);
}