Add logic to VFS rename: If target of rename exists and is a directory, then the source file should be moved 'under' the target directory. POSIX also requires that if the target is a file, then that old file must be deleted.

This commit is contained in:
Gregory Nutt
2017-02-11 11:18:30 -06:00
parent af5a8e73d3
commit bd7d3a92f5
3 changed files with 121 additions and 104 deletions
+4 -1
View File
@@ -2419,7 +2419,10 @@ int fat_rename(FAR struct inode *mountpt, FAR const char *oldrelpath,
{
if (ret == OK)
{
/* It is an error if the object at newrelpath already exists */
/* It is an error if the directory entry at newrelpath already
* exists. The necessary steps to avoid this case should have
* been handled by higher level logic in the VFS.
*/
ret = -EEXIST;
}