diff packages/language/c/libc/stdio/current/src/common/fopen.cxx @ 1167:ebabafdc2d94

* src/common/fclose.cxx (fclose): fclose would seg-fault if passed NULL FILE pointer. Now returns error. Also cleaned up some exit paths to call Cyg_libc_stdio_files::unlock() * src/common/fopen.cxx (fopen): Cleaned up some exit paths to call Cyg_libc_stdio_files::unlock()
author asl
date Mon, 18 Aug 2003 19:45:33 +0000
parents d2c90368aeef
children 871b38a618f4
line wrap: on
line diff
--- a/packages/language/c/libc/stdio/current/src/common/fopen.cxx
+++ b/packages/language/c/libc/stdio/current/src/common/fopen.cxx
@@ -156,6 +156,7 @@ static FILE *fopen_inner( cyg_stdio_hand
     if (i == FOPEN_MAX) { // didn't find an empty slot
         errno = EMFILE;
         cyg_stdio_close( dev );
+        Cyg_libc_stdio_files::unlock();
         return NULL;
     } // if
 
@@ -169,6 +170,7 @@ static FILE *fopen_inner( cyg_stdio_hand
     curr_stream = (Cyg_StdioStream *)malloc(sizeof(*curr_stream));
     if (curr_stream == NULL) {
         cyg_stdio_close( dev );
+        Cyg_libc_stdio_files::unlock();
         errno = ENOMEM;
         return NULL;
     } // if