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>
This commit is contained in:
parent
6c3a5d263f
commit
414e794811
|
@ -1,3 +1,9 @@
|
||||||
|
2015-12-08 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2015-12-07 Nick Withers <nick.withers@anu.edu.au>
|
2015-12-07 Nick Withers <nick.withers@anu.edu.au>
|
||||||
|
|
||||||
* libc/sys/arm/sys/param.h (NBBY): Define if not already defined.
|
* libc/sys/arm/sys/param.h (NBBY): Define if not already defined.
|
||||||
|
|
|
@ -209,7 +209,7 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp),
|
||||||
FREELB (ptr, fp);
|
FREELB (ptr, fp);
|
||||||
fp->_lb._size = 0;
|
fp->_lb._size = 0;
|
||||||
fp->_flags &= ~__SORD;
|
fp->_flags &= ~__SORD;
|
||||||
fp->_flags2 = 0;
|
fp->_flags2 &= ~__SWID;
|
||||||
memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
|
memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
|
||||||
|
|
||||||
if (f < 0)
|
if (f < 0)
|
||||||
|
|
|
@ -208,6 +208,9 @@ _DEFUN (_freopen64_r, (ptr, file, mode, fp),
|
||||||
if (HASLB (fp))
|
if (HASLB (fp))
|
||||||
FREELB (ptr, fp);
|
FREELB (ptr, fp);
|
||||||
fp->_lb._size = 0;
|
fp->_lb._size = 0;
|
||||||
|
fp->_flags &= ~__SORD;
|
||||||
|
fp->_flags2 &= ~__SWID;
|
||||||
|
memset (&fp->_mbstate, 0, sizeof (_mbstate_t));
|
||||||
|
|
||||||
if (f < 0)
|
if (f < 0)
|
||||||
{ /* did not get it after all */
|
{ /* did not get it after all */
|
||||||
|
|
Loading…
Reference in New Issue