From 96faf15ff009431d95f6b86f4f203a71df6a0448 Mon Sep 17 00:00:00 2001 From: pfg Date: Tue, 22 Jul 2014 16:10:56 +0000 Subject: rewind: always clear error indicator. Required by POSIX: http://pubs.opengroup.org/onlinepubs/009695399/functions/rewind.html Obtained from: Apple Inc. (Libc 997.90.3) MFC after: 1 week --- lib/libc/stdio/rewind.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/libc/stdio/rewind.c') diff --git a/lib/libc/stdio/rewind.c b/lib/libc/stdio/rewind.c index ff4c907..133e3f4 100644 --- a/lib/libc/stdio/rewind.c +++ b/lib/libc/stdio/rewind.c @@ -53,9 +53,8 @@ rewind(FILE *fp) __sinit(); FLOCKFILE(fp); - if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) { - clearerr_unlocked(fp); + if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) errno = serrno; - } + clearerr_unlocked(fp); /* POSIX: clear stdio error regardless */ FUNLOCKFILE(fp); } -- cgit v1.1