X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Fyaffsfs.c;h=191c34f6bd1b6f79209c5642a4df244e1b79a85a;hp=9fc4417eb958954b448558eb4b45a294332c520b;hb=570d9b811895119f6b3411678cbdcaa27226f403;hpb=4a700fe570d217c2c5df87070db7c2652bc0eaaf diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 9fc4417..191c34f 100644 --- 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->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 @@ -1186,7 +1195,7 @@ int yaffs_fstat(int fd, struct yaffs_stat *buf) return retVal; } - +#ifndef CONFIG_YAFFS_WINCE /* xattrib functions */ @@ -1440,6 +1449,7 @@ int yaffs_fremovexattr(int fd, const char *name) return retVal; } +#endif #ifdef CONFIG_YAFFS_WINCE int yaffs_get_wince_times(int fd, unsigned *wctime, unsigned *watime, unsigned *wmtime)