summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-07-20 20:14:15 +0000
committerpfg <pfg@FreeBSD.org>2014-07-20 20:14:15 +0000
commit30b6369746e5c67ea575ac72604b40bfdd81e6d7 (patch)
tree5a14a51dbb0a3a9eb079e337a7dafb18cdd314e5 /lib/libc
parent4f16edc0eea6d756d24b997c4455a37f54a64a0c (diff)
downloadFreeBSD-src-30b6369746e5c67ea575ac72604b40bfdd81e6d7.zip
FreeBSD-src-30b6369746e5c67ea575ac72604b40bfdd81e6d7.tar.gz
Use a correct errno in freopen.
Use EBADF instead of EINVAL when working around incorrect O_ACCMODE. Phabric: D442 Obtained from: Apple Inc. (Libc 997.90.3) Reviewed by: jilles MFC after: 1 week
Diffstat (limited to 'lib/libc')
-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 0ff83bf..28b54f8 100644
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -97,7 +97,7 @@ freopen(const char * __restrict file, const char * __restrict mode,
(dflags & (O_ACCMODE | O_EXEC)) != (oflags & O_ACCMODE)) {
fclose(fp);
FUNLOCKFILE(fp);
- errno = EINVAL;
+ errno = EBADF;
return (NULL);
}
if (fp->_flags & __SWR)
OpenPOWER on IntegriCloud