aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libio/ioungetc.c')
-rw-r--r--libio/ioungetc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libio/ioungetc.c b/libio/ioungetc.c
index 951064fa12..917cad8abb 100644
--- a/libio/ioungetc.c
+++ b/libio/ioungetc.c
@@ -33,6 +33,8 @@ _IO_ungetc (int c, _IO_FILE *fp)
CHECK_FILE (fp, EOF);
if (c == EOF)
return EOF;
+ if (!_IO_need_lock (fp))
+ return _IO_sputbackc (fp, (unsigned char) c);
_IO_acquire_lock (fp);
result = _IO_sputbackc (fp, (unsigned char) c);
_IO_release_lock (fp);