X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Fyaffsfs.c;h=76a397cf6a06e803dc7d9673c009b76c3b4a5674;hp=29a920930013ad4f51334fcb294305e291b01fbe;hb=0d62a49dfe174bd70d289f0cf8e97c78585dd359;hpb=2b102a7c5c9a5332e8159aa1c8c7d149596327ff diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 29a9209..76a397c 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -1314,6 +1314,7 @@ int yaffs_rename(const YCHAR *oldPath, const YCHAR *newPath) struct yaffs_obj *olddir = NULL; struct yaffs_obj *newdir = NULL; struct yaffs_obj *obj = NULL; + struct yaffs_obj *newobj = NULL; YCHAR *oldname; YCHAR *newname; int result= YAFFS_FAIL; @@ -1340,6 +1341,7 @@ int yaffs_rename(const YCHAR *oldPath, const YCHAR *newPath) olddir = yaffsfs_FindDirectory(NULL,oldPath,&oldname,0,¬OldDir); newdir = yaffsfs_FindDirectory(NULL,newPath,&newname,0,¬NewDir); obj = yaffsfs_FindObject(NULL,oldPath,0,0,NULL,NULL); + newobj = yaffsfs_FindObject(NULL,newPath,0,0,NULL,NULL); /* If the object being renamed is a directory and the * path ended with a "/" then the olddir == obj. @@ -1362,6 +1364,9 @@ int yaffs_rename(const YCHAR *oldPath, const YCHAR *newPath) } else if(obj->my_dev->read_only){ yaffsfs_SetError(-EROFS); rename_allowed = 0; + } else if(yaffs_is_non_empty_dir(newobj)){ + yaffsfs_SetError(-ENOTEMPTY); + rename_allowed = 0; } else if(olddir->my_dev != newdir->my_dev) { /* Rename must be on same device */ yaffsfs_SetError(-EXDEV);