diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2015-12-08 18:44:23 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-12-08 18:44:23 +0100 |
commit | 414e7948118bb3b7071e7c8cbddcf371e0d48e38 (patch) | |
tree | b66300de097cb4c8e82f961f53dcf384dfa45e45 /newlib/libc/stdio64/freopen64.c | |
parent | 6c3a5d263f3cdfb6703434439bdc84c3a1e29159 (diff) | |
download | newlib-414e7948118bb3b7071e7c8cbddcf371e0d48e38.zip newlib-414e7948118bb3b7071e7c8cbddcf371e0d48e38.tar.gz newlib-414e7948118bb3b7071e7c8cbddcf371e0d48e38.tar.bz2 |
Fix re-initialization of FILE flags and mbstate in freopen
* libc/stdio/freopen.c (_freopen_r): Only reset __SWID bit per SUSv4.
* libc/stdio64/freopen64.c (_freopen64_r): Add missing resetting of
flag values and _mbstate.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/stdio64/freopen64.c')
-rw-r--r-- | newlib/libc/stdio64/freopen64.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/newlib/libc/stdio64/freopen64.c b/newlib/libc/stdio64/freopen64.c index dfe36ea..a183fb8 100644 --- a/newlib/libc/stdio64/freopen64.c +++ b/newlib/libc/stdio64/freopen64.c @@ -208,6 +208,9 @@ _DEFUN (_freopen64_r, (ptr, file, mode, fp), if (HASLB (fp)) FREELB (ptr, fp); fp->_lb._size = 0; + fp->_flags &= ~__SORD; + fp->_flags2 &= ~__SWID; + memset (&fp->_mbstate, 0, sizeof (_mbstate_t)); if (f < 0) { /* did not get it after all */ |