aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdio/ungetc.c
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2023-11-11 01:09:47 +0900
committerCorinna Vinschen <corinna@vinschen.de>2023-11-20 20:59:12 +0100
commitbc986b7ff668aa98372fc4e885307339e7ab3f51 (patch)
tree4a8b16525b74690bafcebe896c427c3ae94a025f /newlib/libc/stdio/ungetc.c
parentd36b4f3f069881b2613b2754d6492d596c9e6ab9 (diff)
downloadnewlib-bc986b7ff668aa98372fc4e885307339e7ab3f51.zip
newlib-bc986b7ff668aa98372fc4e885307339e7ab3f51.tar.gz
newlib-bc986b7ff668aa98372fc4e885307339e7ab3f51.tar.bz2
stdio: Fix bugs in commit 3d94e07c49b5
The commit 3d94e07c49b5 has a few bugs which cause testsuite failure in libstdc++. This is due to excess orientation check in __srefill_r() and _ungetc_r(). Further, sscanf() family also calls ssvfscanf() family with fp->_file == -1. This causes undesired orientation set/check for sscanf() family. This patch fixes these problems. Also, as in GLibC, do not set orientation in ungetc, and only set, but do not check orientation in ungetwc. Fixes: 3d94e07c49b5 ("newlib: libc: Fix crash on fprintf to a wide-oriented stream.") Reported-by: Christophe Lyon <christophe.lyon@linaro.org> Reported-by: Joel Sherrill <joel@rtems.org> Co-developed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/stdio/ungetc.c')
-rw-r--r--newlib/libc/stdio/ungetc.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/newlib/libc/stdio/ungetc.c b/newlib/libc/stdio/ungetc.c
index 79914af..8b10c82 100644
--- a/newlib/libc/stdio/ungetc.c
+++ b/newlib/libc/stdio/ungetc.c
@@ -125,12 +125,6 @@ _ungetc_r (struct _reent *rptr,
_newlib_flockfile_start (fp);
- if (ORIENT (fp, -1) != -1)
- {
- _newlib_flockfile_exit (fp);
- return EOF;
- }
-
/* After ungetc, we won't be at eof anymore */
fp->_flags &= ~__SEOF;