]> git.saurik.com Git - apple/libc.git/blame - stdio/FreeBSD/fclose.c.patch
Libc-763.13.tar.gz
[apple/libc.git] / stdio / FreeBSD / fclose.c.patch
CommitLineData
1f2f436a
A
1--- fclose.c.bsdnew 2009-11-11 13:33:03.000000000 -0800
2+++ fclose.c 2009-11-11 13:33:03.000000000 -0800
3@@ -49,6 +49,13 @@ fclose(FILE *fp)
224c7076
A
4 {
5 int r;
6
34e8f829
A
7+ if (!__sdidinit)
8+ __sinit();
9+
224c7076
A
10+ if (fp == NULL) {
11+ errno = EFAULT;
12+ return (EOF);
13+ }
14 if (fp->_flags == 0) { /* not open! */
15 errno = EBADF;
16 return (EOF);
1f2f436a 17@@ -65,7 +72,7 @@ fclose(FILE *fp)
34e8f829
A
18 FREELB(fp);
19 fp->_file = -1;
20 fp->_r = fp->_w = 0; /* Mess up if reaccessed. */
21- fp->_flags = 0; /* Release this FILE for reuse. */
22+ __sfprelease(fp); /* Release this FILE for reuse. */
23 FUNLOCKFILE(fp);
24 return (r);
25 }