X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs%2F.git;a=blobdiff_plain;f=direct%2Fyaffsfs.c;fp=direct%2Fyaffsfs.c;h=ff7f459f4d31f61cb554deba4ae2cf685a71a03b;hp=6fc0c8263f40f1992907995e94a1b2fe16e19d36;hb=c668bb26fb948b3dba6a6000ac2334d833e67a80;hpb=3740a716679e0377a54427c683f5fe475c9fff2e diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 6fc0c82..ff7f459 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -25,7 +25,7 @@ #endif -const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.3 2003-02-19 00:29:55 charles Exp $"; +const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.4 2003-02-24 23:49:29 charles Exp $"; // configurationList is the list of devices that are supported static yaffsfs_DeviceConfiguration *yaffsfs_configurationList; @@ -348,6 +348,7 @@ int yaffs_open(const char *path, int oflag, int mode) int alreadyExclusive = 0; int openDenied = 0; int symDepth = 0; + int errorReported = 0; int i; @@ -399,6 +400,14 @@ int yaffs_open(const char *path, int oflag, int mode) openDenied = 1; } + // Open should fail if O_CREAT and O_EXCL are specified + if((oflag & O_EXCL) && (oflag & O_CREAT)) + { + openDenied = 1; + yaffsfs_SetError(-EEXIST); + errorReported = 1; + } + // Check file permissions if( (oflag & (O_RDWR | O_WRONLY)) == 0 && // ie O_RDONLY !(obj->st_mode & S_IREAD)) @@ -453,7 +462,11 @@ int yaffs_open(const char *path, int oflag, int mode) else { yaffsfs_PutHandle(handle); - yaffsfs_SetError(-EACCESS); + if(!errorReported) + { + yaffsfs_SetError(-EACCESS); + errorReported = 1; + } handle = -1; } @@ -1339,5 +1352,6 @@ int yaffs_DumpDevStruct(const char *path) dev->passiveGarbageCollections ); } + return 0; }