From a3eb935764e3431a6128e1a633a0ef4d8175c38e Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 22 Apr 2008 17:03:32 +0000 Subject: Fix a leak in the recent fixes for file descriptors > SHRT_MAX. In the case of a file descriptor we can't handle, clear the FILE structure's flags so it can be reused. MFC after: 1 week Reported by: otto @ OpenBSD --- lib/libc/stdio/fopen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/libc') diff --git a/lib/libc/stdio/fopen.c b/lib/libc/stdio/fopen.c index 14ec9bc..6fe536a 100644 --- a/lib/libc/stdio/fopen.c +++ b/lib/libc/stdio/fopen.c @@ -73,6 +73,7 @@ fopen(file, mode) * open. */ if (f > SHRT_MAX) { + fp->_flags = 0; /* release */ _close(f); errno = EMFILE; return (NULL); -- cgit v1.1