X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=direct%2Fyaffsfs.c;h=3be1ea7d13a83a521b2ec4f78c551519730f5d9d;hb=97f9eea27dc6b83fe55f9b86adbb5e4961ea921a;hp=5461a48b397edb6fba64afa1d96c2a43dde1e3ec;hpb=d267d4f1779ec90e9e81fdfa3f06ccd2430ea86c;p=yaffs2.git diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 5461a48..3be1ea7 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -24,7 +24,7 @@ #endif -const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.22 2008-08-19 23:14:22 charles Exp $"; +const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.25 2009-03-05 01:47:17 charles Exp $"; // configurationList is the list of devices that are supported static yaffsfs_DeviceConfiguration *yaffsfs_configurationList; @@ -489,7 +489,7 @@ int yaffs_open(const YCHAR *path, int oflag, int mode) // Check if the object is already in use alreadyOpen = alreadyExclusive = 0; - for(i = 0; i <= YAFFSFS_N_HANDLES; i++) + for(i = 0; i < YAFFSFS_N_HANDLES; i++) { if(i != handle && @@ -630,7 +630,7 @@ int yaffs_close(int fd) h->obj->inUse--; if(h->obj->inUse <= 0 && h->obj->unlinked) { - yaffs_DeleteFile(h->obj); + yaffs_DeleteObject(h->obj); } yaffsfs_PutHandle(fd); retVal = 0; @@ -1284,7 +1284,7 @@ int yaffs_set_wince_times(int fd, static int yaffsfs_DoChMod(yaffs_Object *obj,mode_t mode) { - int result; + int result = -1; if(obj) { @@ -1849,14 +1849,19 @@ int yaffs_symlink(const YCHAR *oldpath, const YCHAR *newpath) yaffsfs_Lock(); parent = yaffsfs_FindDirectory(NULL,newpath,&name,0); - obj = yaffs_MknodSymLink(parent,name,mode,0,0,oldpath); - if(obj) - { - retVal = 0; - } - else - { - yaffsfs_SetError(-ENOSPC); // just assume no space for now + if(parent){ + obj = yaffs_MknodSymLink(parent,name,mode,0,0,oldpath); + if(obj) + { + retVal = 0; + } + else + { + yaffsfs_SetError(-ENOSPC); // just assume no space for now + retVal = -1; + } + } else { + yaffsfs_SetError(-EINVAL); retVal = -1; }