Imported the bfs_rename() permission check fix from the Haiku version.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18720 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-08-30 23:37:57 +00:00
parent 9b906ccf04
commit ffacc65107
@@ -1159,11 +1159,18 @@ bfs_rename(void *_ns, void *_oldDir, const char *oldName, void *_newDir, const c
if (oldDirectory == newDirectory && !strcmp(oldName, newName))
return B_OK;
// are we allowed to do what we've been told?
status_t status = oldDirectory->CheckPermissions(W_OK);
if (status == B_OK)
status = newDirectory->CheckPermissions(W_OK);
if (status < B_OK)
return status;
RecursiveLocker locker(volume->Lock());
// get the directory's tree, and a pointer to the inode which should be changed
BPlusTree *tree;
status_t status = oldDirectory->GetTree(&tree);
status = oldDirectory->GetTree(&tree);
if (status < B_OK)
RETURN_ERROR(status);