yaffs direct: Fix EROFS handling for yaffs_access
authorCharles Manning <cdhmanning@gmail.com>
Fri, 26 Nov 2010 01:40:20 +0000 (14:40 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Fri, 26 Nov 2010 01:40:20 +0000 (14:40 +1300)
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
direct/yaffsfs.c

index e3f6fb0..f6654cf 100644 (file)
@@ -1183,6 +1183,7 @@ int yaffs_truncate(const YCHAR *path,off_t new_size)
        yaffsfs_Lock();
 
        obj = yaffsfs_FindObject(NULL,path,0,1,&dir,&notDir,&loop);
+       obj = yaffsfs_FollowLink(obj,0,&loop);
 
        if(!dir && notDir)
                yaffsfs_SetError(-ENOTDIR);
@@ -1962,7 +1963,9 @@ int yaffs_access(const YCHAR *path, int amode)
                yaffsfs_SetError(-ELOOP);
        else if(!dir || !obj) 
                yaffsfs_SetError(-ENOENT);
-       else {
+       else if((amode & W_OK) && obj->my_dev->read_only)
+               yaffsfs_SetError(-EROFS);
+       else{
                int access_ok = 1;
 
                if((amode & R_OK) && !(obj->yst_mode & S_IREAD))