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
This commit is contained in:
jhb 2008-04-22 17:03:32 +00:00
parent f40924813a
commit a3eb935764

View File

@ -73,6 +73,7 @@ fopen(file, mode)
* open.
*/
if (f > SHRT_MAX) {
fp->_flags = 0; /* release */
_close(f);
errno = EMFILE;
return (NULL);