yaffs direct: Fix yaffs_symlink error reporting for EEXIST
authorCharles Manning <cdhmanning@gmail.com>
Tue, 16 Nov 2010 03:49:34 +0000 (16:49 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Tue, 16 Nov 2010 03:49:34 +0000 (16:49 +1300)
Do a check if an object already exists.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
direct/yaffsfs.c

index 753bf4f..8a0d66c 100644 (file)
@@ -2491,10 +2491,10 @@ int yaffs_symlink(const YCHAR *oldpath, const YCHAR *newpath)
                obj = yaffs_create_symlink(parent,name,mode,0,0,oldpath);
                if(obj)
                        retVal = 0;
-               else{
-                       yaffsfs_SetError(-ENOSPC); /* just assume no space for now */
-                       retVal = -1;
-               }
+               else if (yaffsfs_FindObject(NULL,newpath,0,0, NULL))
+                       yaffsfs_SetError(-EEXIST);
+               else
+                       yaffsfs_SetError(-ENOSPC);
        }
 
        yaffsfs_Unlock();