rewind must clear the error indicator in addition to seeking
authorRich Felker <dalias@aerifal.cx>
Tue, 22 Feb 2011 22:11:35 +0000 (17:11 -0500)
committerRich Felker <dalias@aerifal.cx>
Tue, 22 Feb 2011 22:11:35 +0000 (17:11 -0500)
src/stdio/rewind.c

index 7944b43..6f4b58b 100644 (file)
@@ -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);
 }