diff options
author | pfg <pfg@FreeBSD.org> | 2014-08-03 18:28:10 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-08-03 18:28:10 +0000 |
commit | 5c8726d1b258dd69e1f906f463c2bcc65c1b64a5 (patch) | |
tree | fffeed563f0bdf924883b06dc4de075adb02c829 /lib/libc/stdio/rewind.c | |
parent | eabfc5bd75e50f98ad4963ab269825213771c398 (diff) | |
download | FreeBSD-src-5c8726d1b258dd69e1f906f463c2bcc65c1b64a5.zip FreeBSD-src-5c8726d1b258dd69e1f906f463c2bcc65c1b64a5.tar.gz |
MFC r268926, r268930, r268983:
Use a correct errno in freopen.
Use EBADF instead of EINVAL when working around incorrect O_ACCMODE.
Adjust errno on failed prepwrite.
rewind: always clear error indicator as required by POSIX.
Obtained from: Apple Inc. (Libc 997.90.3)
Phabric: D442
Diffstat (limited to 'lib/libc/stdio/rewind.c')
-rw-r--r-- | lib/libc/stdio/rewind.c | 5 |
1 files changed, 2 insertions, 3 deletions
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); } |