svn commit: r268926 - head/lib/libc/stdio

Pedro F. Giffuni pfg at FreeBSD.org
Sun Jul 20 20:14:16 UTC 2014


Author: pfg
Date: Sun Jul 20 20:14:15 2014
New Revision: 268926
URL: http://svnweb.freebsd.org/changeset/base/268926

Log:
  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

Modified:
  head/lib/libc/stdio/freopen.c

Modified: head/lib/libc/stdio/freopen.c
==============================================================================
--- head/lib/libc/stdio/freopen.c	Sun Jul 20 20:11:34 2014	(r268925)
+++ head/lib/libc/stdio/freopen.c	Sun Jul 20 20:14:15 2014	(r268926)
@@ -97,7 +97,7 @@ freopen(const char * __restrict file, co
 		    (dflags & (O_ACCMODE | O_EXEC)) != (oflags & O_ACCMODE)) {
 			fclose(fp);
 			FUNLOCKFILE(fp);
-			errno = EINVAL;
+			errno = EBADF;
 			return (NULL);
 		}
 		if (fp->_flags & __SWR)


More information about the svn-src-all mailing list