瀏覽代碼

rewind must clear the error indicator in addition to seeking

Rich Felker 14 年之前
父節點
當前提交
a6238c30d1
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/stdio/rewind.c

+ 5 - 2
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);
 }