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)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to