about summary refs log tree commit diff
path: root/src/stdio/fflush.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/fflush.c')
-rw-r--r--src/stdio/fflush.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/stdio/fflush.c b/src/stdio/fflush.c
index c2881065..bf1e8437 100644
--- a/src/stdio/fflush.c
+++ b/src/stdio/fflush.c
@@ -9,8 +9,11 @@ int fflush(FILE *f)
 	if (!f) {
 		int r = __stdout_used ? fflush(__stdout_used) : 0;
 
-		for (f=*__ofl_lock(); f; f=f->next)
+		for (f=*__ofl_lock(); f; f=f->next) {
+			FLOCK(f);
 			if (f->wpos > f->wbase) r |= fflush(f);
+			FUNLOCK(f);
+		}
 		__ofl_unlock();
 
 		return r;