rename() is supposed to fail when the target exists and is not a

directory only if the source is a directory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25144 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-04-25 03:21:14 +00:00
parent acb16f5574
commit fd4a010b05

View File

@ -1015,6 +1015,10 @@ bfs_rename(fs_volume *_volume, fs_vnode *_oldDir, const char *oldName,
if (vnode.Get(&other) < B_OK)
return B_NAME_IN_USE;
// only allowed, if either both nodes are directories or neither is
if (inode->IsDirectory() != other->IsDirectory())
return other->IsDirectory() ? B_IS_A_DIRECTORY : B_NOT_A_DIRECTORY;
status = newDirectory->Remove(transaction, newName, NULL,
other->IsDirectory());
if (status < B_OK)