about summary refs log tree commit diff
path: root/libio/getchar.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/getchar.c')
-rw-r--r--libio/getchar.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libio/getchar.c b/libio/getchar.c
index 5b41595d17..d79932114e 100644
--- a/libio/getchar.c
+++ b/libio/getchar.c
@@ -33,6 +33,8 @@ int
 getchar (void)
 {
   int result;
+  if (!_IO_need_lock (_IO_stdin))
+    return _IO_getc_unlocked (_IO_stdin);
   _IO_acquire_lock (_IO_stdin);
   result = _IO_getc_unlocked (_IO_stdin);
   _IO_release_lock (_IO_stdin);