]> git.saurik.com Git - apple/libc.git/blob - stdio/FreeBSD/fopen.c.patch
Libc-594.9.5.tar.gz
[apple/libc.git] / stdio / FreeBSD / fopen.c.patch
1 --- fopen.c.orig 2009-02-15 03:11:22.000000000 -0800
2 +++ fopen.c 2009-02-15 17:53:37.000000000 -0800
3 @@ -34,6 +34,15 @@
4 * SUCH DAMAGE.
5 */
6
7 +#ifdef VARIANT_DARWINEXTSN
8 +#define _DARWIN_UNLIMITED_STREAMS
9 +#define COUNT 0
10 +#elif defined(VARIANT_LEGACY)
11 +#define COUNT 0
12 +#else
13 +#define COUNT 1
14 +#endif
15 +
16 #if defined(LIBC_SCCS) && !defined(lint)
17 static char sccsid[] = "@(#)fopen.c 8.1 (Berkeley) 6/4/93";
18 #endif /* LIBC_SCCS and not lint */
19 @@ -61,10 +70,10 @@ fopen(file, mode)
20
21 if ((flags = __sflags(mode, &oflags)) == 0)
22 return (NULL);
23 - if ((fp = __sfp()) == NULL)
24 + if ((fp = __sfp(COUNT)) == NULL)
25 return (NULL);
26 if ((f = _open(file, oflags, DEFFILEMODE)) < 0) {
27 - fp->_flags = 0; /* release */
28 + __sfprelease(fp); /* release */
29 return (NULL);
30 }
31 fp->_file = f;