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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user