summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/rewind.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2001-09-01 15:28:24 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2001-09-01 15:28:24 +0000
commit35e1a550de699406e01db36552dbb4247a2bff94 (patch)
treeee54a20cc4f7b4c40b42a25070f3d75c3d0f8d9e /lib/libc/stdio/rewind.c
parentd911eb4536f396ee5f3b363607e19e0153b70e8b (diff)
Notes
Diffstat (limited to 'lib/libc/stdio/rewind.c')
-rw-r--r--lib/libc/stdio/rewind.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/stdio/rewind.c b/lib/libc/stdio/rewind.c
index af9232a7b17f..2db21c789f58 100644
--- a/lib/libc/stdio/rewind.c
+++ b/lib/libc/stdio/rewind.c
@@ -52,13 +52,16 @@ static const char rcsid[] =
void
rewind(FILE *fp)
{
+ int serrno = errno;
+
/* make sure stdio is set up */
if (!__sdidinit)
__sinit();
FLOCKFILE(fp);
- if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0)
+ if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) {
clearerr_unlocked(fp);
+ errno = serrno;
+ }
FUNLOCKFILE(fp);
- /* errno required by POSIX to sense error, don't zero it here */
}