projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yaffs Fix problem trying to mkdir a mountpt in yaffs direct
[yaffs2.git]
/
direct
/
yaffsfs.c
diff --git
a/direct/yaffsfs.c
b/direct/yaffsfs.c
index fc68b969e017c9a82af5b66452f95cfdfae87408..9ac08abb15be867cd69da6e466cd54523cfbf57a 100644
(file)
--- a/
direct/yaffsfs.c
+++ b/
direct/yaffsfs.c
@@
-573,12
+573,21
@@
int yaffs_open(const YCHAR *path, int oflag, int mode)
if(obj)
obj = yaffs_GetEquivalentObject(obj);
if(obj)
obj = yaffs_GetEquivalentObject(obj);
- if(obj && obj->variantType != YAFFS_OBJECT_TYPE_FILE)
+ if(obj &&
+ obj->variantType != YAFFS_OBJECT_TYPE_FILE &&
+ obj->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
obj = NULL;
if(obj){
obj = NULL;
if(obj){
- /* The file already exists */
+ /* The file already exists or it might be a directory */
+
+ /* If it is a directory then we can't open it as a file */
+ if(obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY){
+ openDenied = 1;
+ yaffsfs_SetError(-EISDIR);
+ errorReported = 1;
+ }
/* Open should fail if O_CREAT and O_EXCL are specified since
* the file exists
/* Open should fail if O_CREAT and O_EXCL are specified since
* the file exists
@@
-1628,7
+1637,10
@@
int yaffs_mkdir(const YCHAR *path, mode_t mode)
yaffsfs_Lock();
parent = yaffsfs_FindDirectory(NULL,path,&name,0);
yaffsfs_Lock();
parent = yaffsfs_FindDirectory(NULL,path,&name,0);
- if(parent && parent->myDev->readOnly){
+ if(parent && yaffs_strnlen(name,5) == 0){
+ /* Trying to make the root itself */
+ yaffsfs_SetError(-EEXIST);
+ } else if(parent && parent->myDev->readOnly){
yaffsfs_SetError(-EINVAL);
} else {
if(parent)
yaffsfs_SetError(-EINVAL);
} else {
if(parent)
@@
-1651,6
+1663,14
@@
int yaffs_mkdir(const YCHAR *path, mode_t mode)
return retVal;
}
return retVal;
}
+void * yaffs_getdev(const YCHAR *path)
+{
+ yaffs_Device *dev=NULL;
+ YCHAR *dummy;
+ dev = yaffsfs_FindDevice(path,&dummy);
+ return (void *)dev;
+}
+
int yaffs_mount2(const YCHAR *path,int readOnly)
{
int retVal=-1;
int yaffs_mount2(const YCHAR *path,int readOnly)
{
int retVal=-1;
@@
-1702,7
+1722,7
@@
int yaffs_sync(const YCHAR *path)
yaffs_FlushEntireDeviceCache(dev);
yaffs_CheckpointSave(dev);
yaffs_FlushEntireDeviceCache(dev);
yaffs_CheckpointSave(dev);
-
+ retVal = 0;
} else
/* todo error - not mounted. */
} else
/* todo error - not mounted. */