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 5d9247a43a063753a310304a1eebdf94b6e666ee..e9a80703c31b788fd3030e95bbda20766ac8724a 100644 (file)
@@ -36,6 +36,7 @@ const error_entry error_list[] = {
        { EEXIST , "EEXIST"},
        { ENOTDIR , "ENOTDIR"},
        { EISDIR , "EISDIR"},
+       { ENFILE, "ENFILE"},
        { 0, NULL }
 };
 
index ea3322374a2b26562af4ecc59ae9caf3faf72909..573c68b3b5ef60a96cbea3252f530cd882547d00 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 2f9063bf7a9e06ab1c2bf501e06bd61526b5a485..38a3595fc34969f0203d555b92eeeff22254d288 100644 (file)
 #define EINVAL 22
 #endif
 
+#ifndef ENFILE
+#define ENFILE 23
+#endif
+
 #ifndef EBADF
 #define EBADF  9
 #endif