Loading...
--- Libc/Libc-763.13/stdio/FreeBSD/fclose.c
+++ Libc/Libc-825.24/stdio/FreeBSD/fclose.c
@@ -49,6 +49,13 @@
{
int r;
+ if (!__sdidinit)
+ __sinit();
+
+ if (fp == NULL) {
+ errno = EFAULT;
+ return (EOF);
+ }
if (fp->_flags == 0) { /* not open! */
errno = EBADF;
return (EOF);
@@ -65,7 +72,7 @@
FREELB(fp);
fp->_file = -1;
fp->_r = fp->_w = 0; /* Mess up if reaccessed. */
- fp->_flags = 0; /* Release this FILE for reuse. */
+ __sfprelease(fp); /* Release this FILE for reuse. */
FUNLOCKFILE(fp);
return (r);
}