yaffs direct: Add proper error handler for too many files open
authorCharles Manning <cdhmanning@gmail.com>
Sun, 31 Oct 2010 22:06:56 +0000 (11:06 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Sun, 31 Oct 2010 22:06:56 +0000 (11:06 +1300)
If you open too many files then you get -ENFILE.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
direct/python/yaffs_error_converter.c
direct/yaffsfs.c
yportenv.h

index 5d9247a..e9a8070 100644 (file)
@@ -36,6 +36,7 @@ const error_entry error_list[] = {
        { EEXIST , "EEXIST"},
        { ENOTDIR , "ENOTDIR"},
        { EISDIR , "EISDIR"},
+       { ENFILE, "ENFILE"},
        { 0, NULL }
 };
 
index ea33223..573c68b 100644 (file)
@@ -612,7 +612,10 @@ int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int sharing)
 
        handle = yaffsfs_GetNewHandle();
 
-       if(handle >= 0){
+       if(handle < 0){
+               yaffsfs_SetError(-ENFILE);
+               errorReported = 1;
+       } else {
 
                yh = yaffsfs_GetHandlePointer(handle);
 
index 2f9063b..38a3595 100644 (file)
 #define EINVAL 22
 #endif
 
+#ifndef ENFILE
+#define ENFILE 23
+#endif
+
 #ifndef EBADF
 #define EBADF  9
 #endif