about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/stdio/rewind.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/stdio/rewind.c b/src/stdio/rewind.c
index 7944b434..6f4b58b5 100644
--- a/src/stdio/rewind.c
+++ b/src/stdio/rewind.c
@@ -1,6 +1,9 @@
-#include <stdio.h>
+#include "stdio_impl.h"
 
 void rewind(FILE *f)
 {
-	fseek(f, 0, SEEK_SET);
+	FLOCK(f);
+	__fseeko_unlocked(f, 0, SEEK_SET);
+	f->flags &= ~F_ERR;
+	FUNLOCK(f);
 }