rewind must clear the error indicator in addition to seeking
[musl] / 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);
 }