*** empty log message ***
authorcharles <charles>
Mon, 24 Feb 2003 23:49:29 +0000 (23:49 +0000)
committercharles <charles>
Mon, 24 Feb 2003 23:49:29 +0000 (23:49 +0000)
direct/yaffsfs.c
direct/yaffsfs.h

index 6fc0c8263f40f1992907995e94a1b2fe16e19d36..ff7f459f4d31f61cb554deba4ae2cf685a71a03b 100644 (file)
@@ -25,7 +25,7 @@
 #endif
 
 
 #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;
 
 // 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 alreadyExclusive = 0;
        int openDenied = 0;
        int symDepth = 0;
+       int errorReported = 0;
        
        int i;
        
        
        int i;
        
@@ -399,6 +400,14 @@ int yaffs_open(const char *path, int oflag, int mode)
                                openDenied = 1;
                        }
                        
                                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))
                        // 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);
                else
                {
                        yaffsfs_PutHandle(handle);
-                       yaffsfs_SetError(-EACCESS);
+                       if(!errorReported)
+                       {
+                               yaffsfs_SetError(-EACCESS);
+                               errorReported = 1;
+                       }
                        handle = -1;
                }
                
                        handle = -1;
                }
                
@@ -1339,5 +1352,6 @@ int yaffs_DumpDevStruct(const char *path)
                                dev->passiveGarbageCollections
                );
        }
                                dev->passiveGarbageCollections
                );
        }
+       return 0;
 }
 
 }
 
index 36dc90600dcb0a5599cfc0278544f8a4dd8d9fd3..9a1e41ca165d87b2c32775622c5ae6586e91b5a6 100644 (file)
 #define ENOMEM 12
 #endif
 
 #define ENOMEM 12
 #endif
 
+#ifndef EEXIST
+#define EEXIST 17
+#endif
+
 #ifndef ENOTDIR
 #define ENOTDIR 20
 #endif
 #ifndef ENOTDIR
 #define ENOTDIR 20
 #endif