From: Charles Manning Date: Sun, 31 Oct 2010 22:06:56 +0000 (+1300) Subject: yaffs direct: Add proper error handler for too many files open X-Git-Tag: linux-mainline-patchset-4~145 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=4be24c244e22ef029cf1f014c0cf8433a49a8a37 yaffs direct: Add proper error handler for too many files open If you open too many files then you get -ENFILE. Signed-off-by: Charles Manning --- diff --git a/direct/python/yaffs_error_converter.c b/direct/python/yaffs_error_converter.c index 5d9247a..e9a8070 100644 --- a/direct/python/yaffs_error_converter.c +++ b/direct/python/yaffs_error_converter.c @@ -36,6 +36,7 @@ const error_entry error_list[] = { { EEXIST , "EEXIST"}, { ENOTDIR , "ENOTDIR"}, { EISDIR , "EISDIR"}, + { ENFILE, "ENFILE"}, { 0, NULL } }; diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index ea33223..573c68b 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -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); diff --git a/yportenv.h b/yportenv.h index 2f9063b..38a3595 100644 --- a/yportenv.h +++ b/yportenv.h @@ -210,6 +210,10 @@ #define EINVAL 22 #endif +#ifndef ENFILE +#define ENFILE 23 +#endif + #ifndef EBADF #define EBADF 9 #endif