about summary refs log tree commit diff
path: root/libio/iofflush.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/iofflush.c')
-rw-r--r--libio/iofflush.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libio/iofflush.c b/libio/iofflush.c
index 1f549505c5..6fe2d5262d 100644
--- a/libio/iofflush.c
+++ b/libio/iofflush.c
@@ -32,9 +32,17 @@ _IO_fflush (fp)
     return _IO_flush_all ();
   else
     {
+      int result;
+      _IO_flockfile (fp);
       CHECK_FILE (fp, EOF);
-      return _IO_SYNC (fp) ? EOF : 0;
+      result = _IO_SYNC (fp) ? EOF : 0;
+      _IO_funlockfile (fp);
+      return result;
     }
 }
 
 weak_alias (_IO_fflush, fflush)
+
+#ifdef _IO_MTSAFE_IO
+weak_alias (_IO_fflush, fflush_locked)
+#endif