about summary refs log tree commit diff
path: root/libio/fgetc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/fgetc.c')
-rw-r--r--libio/fgetc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libio/fgetc.c b/libio/fgetc.c
index 19c0a589d9..2aaea05cfe 100644
--- a/libio/fgetc.c
+++ b/libio/fgetc.c
@@ -29,6 +29,10 @@ int
 fgetc (fp)
      FILE *fp;
 {
+  int result;
   CHECK_FILE (fp, EOF);
-  return _IO_getc (fp);
+  flockfile (fp);
+  result = _IO_getc_unlocked (fp);
+  funlockfile (fp);
+  return result;
 }