From d59df8688e297a4a89eb2c76421fb039da0f3c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 24 Apr 2006 23:18:14 +0000 Subject: [PATCH] fclose() should now accept a NULL parameter (doesn't clobber errno, though, as, at least in theory, that should still contain the error from an earlier operation). This might fix bug #500. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17228 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/glibc/libio/iofclose.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/system/libroot/posix/glibc/libio/iofclose.c b/src/system/libroot/posix/glibc/libio/iofclose.c index 25e8ed853f..d345a150c3 100644 --- a/src/system/libroot/posix/glibc/libio/iofclose.c +++ b/src/system/libroot/posix/glibc/libio/iofclose.c @@ -43,6 +43,9 @@ _IO_new_fclose (fp) { int status; + if (fp == NULL) + return -1; + CHECK_FILE(fp, EOF); #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)