Loading...
stdio/FreeBSD/freopen.c.patch Libc-763.13 Libc-498.1.5
--- Libc/Libc-763.13/stdio/FreeBSD/freopen.c.patch
+++ Libc/Libc-498.1.5/stdio/FreeBSD/freopen.c.patch
@@ -1,6 +1,11 @@
---- freopen.c.bsdnew	2009-11-11 13:33:09.000000000 -0800
-+++ freopen.c	2009-11-11 14:45:57.000000000 -0800
-@@ -98,7 +98,7 @@ freopen(file, mode, fp)
+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);
@@ -8,8 +13,8 @@
 +			errno = EBADF;
  			return (NULL);
  		}
- 		if (fp->_flags & __SWR)
-@@ -131,6 +131,8 @@ freopen(file, mode, fp)
+ 		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.
@@ -18,7 +23,7 @@
  	 */
  	if (fp->_flags == 0) {
  		fp->_flags = __SEOF;	/* hold on to it */
-@@ -141,11 +143,18 @@ freopen(file, mode, fp)
+@@ -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 */
@@ -37,21 +42,3 @@
  	}
  
  	/* Get a new descriptor to refer to the new file. */
-@@ -186,7 +195,7 @@ finish:
- 	memset(&fp->_mbstate, 0, sizeof(mbstate_t));
- 
- 	if (f < 0) {			/* did not get it after all */
--		fp->_flags = 0;		/* set it free */
-+		__sfprelease(fp);	/* set it free */
- 		FUNLOCKFILE(fp);
- 		errno = sverrno;	/* restore in case _close clobbered */
- 		return (NULL);
-@@ -212,7 +221,7 @@ finish:
- 	 * open.
- 	 */
- 	if (f > SHRT_MAX) {
--		fp->_flags = 0;		/* set it free */
-+		__sfprelease(fp);	/* set it free */
- 		FUNLOCKFILE(fp);
- 		errno = EMFILE;
- 		return (NULL);