projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yaffs direct: Add EROFS error for hundling chmod on a read-only fs
[yaffs2.git]
/
direct
/
yaffsfs.c
diff --git
a/direct/yaffsfs.c
b/direct/yaffsfs.c
index 203a034c739dfd4287459cb8402746a8b5efb6ee..7a05c2192b4b2fdae5e2f3cb27267d96f5711c7d 100644
(file)
--- a/
direct/yaffsfs.c
+++ b/
direct/yaffsfs.c
@@
-1737,9
+1737,13
@@
int yaffs_access(const YCHAR *path, int amode)
int yaffs_chmod(const YCHAR *path, mode_t mode)
{
struct yaffs_obj *obj;
int yaffs_chmod(const YCHAR *path, mode_t mode)
{
struct yaffs_obj *obj;
-
int retVal = -1;
int retVal = -1;
+ if(mode & ~(0777)){
+ yaffsfs_SetError(-EINVAL);
+ return -1;
+ }
+
yaffsfs_Lock();
obj = yaffsfs_FindObject(NULL,path,0,1);
yaffsfs_Lock();
obj = yaffsfs_FindObject(NULL,path,0,1);
@@
-1747,7
+1751,7
@@
int yaffs_chmod(const YCHAR *path, mode_t mode)
if(!obj)
yaffsfs_SetError(-ENOENT);
else if(obj->my_dev->read_only)
if(!obj)
yaffsfs_SetError(-ENOENT);
else if(obj->my_dev->read_only)
- yaffsfs_SetError(-E
INVAL
);
+ yaffsfs_SetError(-E
ROFS
);
else
retVal = yaffsfs_DoChMod(obj,mode);
else
retVal = yaffsfs_DoChMod(obj,mode);
@@
-1761,16
+1765,20
@@
int yaffs_chmod(const YCHAR *path, mode_t mode)
int yaffs_fchmod(int fd, mode_t mode)
{
struct yaffs_obj *obj;
int yaffs_fchmod(int fd, mode_t mode)
{
struct yaffs_obj *obj;
-
int retVal = -1;
int retVal = -1;
+ if(mode & ~(0777)){
+ yaffsfs_SetError(-EINVAL);
+ return -1;
+ }
+
yaffsfs_Lock();
obj = yaffsfs_GetHandleObject(fd);
if(!obj)
yaffsfs_Lock();
obj = yaffsfs_GetHandleObject(fd);
if(!obj)
- yaffsfs_SetError(-E
NOENT
);
+ yaffsfs_SetError(-E
BADF
);
else if(obj->my_dev->read_only)
else if(obj->my_dev->read_only)
- yaffsfs_SetError(-E
INVAL
);
+ yaffsfs_SetError(-E
ROFS
);
else
retVal = yaffsfs_DoChMod(obj,mode);
else
retVal = yaffsfs_DoChMod(obj,mode);