summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/freopen.c
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-08-03 18:28:10 +0000
committerpfg <pfg@FreeBSD.org>2014-08-03 18:28:10 +0000
commit5c8726d1b258dd69e1f906f463c2bcc65c1b64a5 (patch)
treefffeed563f0bdf924883b06dc4de075adb02c829 /lib/libc/stdio/freopen.c
parenteabfc5bd75e50f98ad4963ab269825213771c398 (diff)
downloadFreeBSD-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/freopen.c')
-rw-r--r--lib/libc/stdio/freopen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c
index dc5508d..b3a07d9 100644
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -96,7 +96,7 @@ freopen(const char * __restrict file, const char * __restrict mode,
(oflags & O_ACCMODE)) {
fclose(fp);
FUNLOCKFILE(fp);
- errno = EINVAL;
+ errno = EBADF;
return (NULL);
}
if (fp->_flags & __SWR)
OpenPOWER on IntegriCloud