From: Charles Manning Date: Tue, 16 Nov 2010 00:51:56 +0000 (+1300) Subject: yaffs direct: Fix error handling in yaffs_access X-Git-Tag: linux-mainline-patchset-4~91 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=a0af04609fa36f2396474a3fbd6ef126de527c70;hp=d84af1d4633120e3dea173c7f91aa8cfc3421706 yaffs direct: Fix error handling in yaffs_access yaffs_access was not returning the correct result. Signed-off-by: Charles Manning --- diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 15d5aeb..6622536 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -1724,7 +1724,7 @@ int yaffs_access(const YCHAR *path, int amode) struct yaffs_obj *obj=NULL; struct yaffs_obj *dir=NULL; - int retval = 0; + int retval = -1; if(amode & ~(R_OK | W_OK | X_OK)){ yaffsfs_SetError(-EINVAL); @@ -1749,10 +1749,10 @@ int yaffs_access(const YCHAR *path, int amode) if((amode & X_OK) && !(obj->yst_mode & S_IEXEC)) access_ok = 0; - if(!access_ok) { + if(!access_ok) yaffsfs_SetError(-EACCES); - retval = -1; - } + else + retval = 0; } yaffsfs_Unlock();