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:
@@ -1159,11 +1159,18 @@ bfs_rename(void *_ns, void *_oldDir, const char *oldName, void *_newDir, const c
|
|||||||
if (oldDirectory == newDirectory && !strcmp(oldName, newName))
|
if (oldDirectory == newDirectory && !strcmp(oldName, newName))
|
||||||
return B_OK;
|
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());
|
RecursiveLocker locker(volume->Lock());
|
||||||
|
|
||||||
// get the directory's tree, and a pointer to the inode which should be changed
|
// get the directory's tree, and a pointer to the inode which should be changed
|
||||||
BPlusTree *tree;
|
BPlusTree *tree;
|
||||||
status_t status = oldDirectory->GetTree(&tree);
|
status = oldDirectory->GetTree(&tree);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
RETURN_ERROR(status);
|
RETURN_ERROR(status);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user