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
This commit is contained in:
Pedro F. Giffuni
2014-07-20 20:14:15 +00:00
parent 587be2d8fe
commit 120d6dd50d
+1 -1
View File
@@ -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)