]> git.saurik.com Git - apple/libc.git/blobdiff - stdio/FreeBSD/freopen.c.patch
Libc-498.1.5.tar.gz
[apple/libc.git] / stdio / FreeBSD / freopen.c.patch
index c9c6e76b1fa9c8883fd6327ec210ea6cf91d2288..899579c4a37f2183bbf2f7c4ab12cd9ebe8b55df 100644 (file)
@@ -1,6 +1,20 @@
---- freopen.c.orig     2004-10-28 23:51:35.000000000 -0700
-+++ freopen.c  2004-10-28 23:53:14.000000000 -0700
-@@ -136,6 +136,8 @@
+Index: freopen.c
+===================================================================
+RCS file: /cvs/root/Libc/stdio/FreeBSD/freopen.c,v
+retrieving revision 1.3
+diff -u -d -b -w -p -r1.3 freopen.c
+--- freopen.c  2004/11/25 19:38:34     1.3
++++ freopen.c  2005/01/25 18:01:26
+@@ -99,7 +99,7 @@ freopen(file, mode, fp)
+                   (oflags & O_ACCMODE)) {
+                       fclose(fp);
+                       FUNLOCKFILE(fp);
+-                      errno = EINVAL;
++                      errno = EBADF;
+                       return (NULL);
+               }
+               if ((oflags ^ dflags) & O_APPEND) {
+@@ -136,6 +136,8 @@ freopen(file, mode, fp)
         * descriptor (if any) was associated with it.  If it was attached to
         * a descriptor, defer closing it; freopen("/dev/stdin", "r", stdin)
         * should work.  This is unnecessary if it was not a Unix file.
@@ -9,7 +23,7 @@
         */
        if (fp->_flags == 0) {
                fp->_flags = __SEOF;    /* hold on to it */
-@@ -146,11 +148,18 @@
+@@ -146,11 +148,18 @@ freopen(file, mode, fp)
                if (fp->_flags & __SWR)
                        (void) __sflush(fp);
                /* if close is NULL, closing is a no-op, hence pointless */