about summary refs log tree commit diff
path: root/src/stdio/rewind.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-22 17:11:35 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-22 17:11:35 -0500
commita6238c30d169cbac6bc4c4977622242063e32270 (patch)
tree757a5b974e8c56c244895751d2c38a242bc336b6 /src/stdio/rewind.c
parent71e6be641fb1e4080c2bb901e83423546d0ad5af (diff)
downloadmusl-a6238c30d169cbac6bc4c4977622242063e32270.tar.gz
musl-a6238c30d169cbac6bc4c4977622242063e32270.tar.xz
musl-a6238c30d169cbac6bc4c4977622242063e32270.zip
rewind must clear the error indicator in addition to seeking
Diffstat (limited to 'src/stdio/rewind.c')
-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);
 }