From c668bb26fb948b3dba6a6000ac2334d833e67a80 Mon Sep 17 00:00:00 2001 From: charles Date: Mon, 24 Feb 2003 23:49:29 +0000 Subject: [PATCH] *** empty log message *** --- direct/yaffsfs.c | 18 ++++++++++++++++-- direct/yaffsfs.h | 4 ++++ 2 files changed, 20 insertions(+), 2 deletions(-) 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; } diff --git a/direct/yaffsfs.h b/direct/yaffsfs.h index 36dc906..9a1e41c 100644 --- a/direct/yaffsfs.h +++ b/direct/yaffsfs.h @@ -100,6 +100,10 @@ #define ENOMEM 12 #endif +#ifndef EEXIST +#define EEXIST 17 +#endif + #ifndef ENOTDIR #define ENOTDIR 20 #endif -- 2.30.2