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){
- /* 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
return retVal;
}
-
+#ifndef CONFIG_YAFFS_WINCE
/* xattrib functions */
return retVal;
}
+#endif
#ifdef CONFIG_YAFFS_WINCE
int yaffs_get_wince_times(int fd, unsigned *wctime, unsigned *watime, unsigned *wmtime)
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)
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;
yaffs_FlushEntireDeviceCache(dev);
yaffs_CheckpointSave(dev);
-
+ retVal = 0;
} else
/* todo error - not mounted. */