bfs: Fixed removing a listener that was never added.
* When the tree constructor failed, the InodeAllocator would try to remove the tree from the transaction. However, in that case, it was never added to it. * Inode::fTree is no longer set if the tree constructor failed. * This fixes bug #10089.
This commit is contained in:
@@ -236,11 +236,18 @@ InodeAllocator::CreateTree()
|
|||||||
if ((fInode->Mode() & S_INDEX_TYPES) == 0)
|
if ((fInode->Mode() & S_INDEX_TYPES) == 0)
|
||||||
fInode->Node().mode |= HOST_ENDIAN_TO_BFS_INT32(S_STR_INDEX);
|
fInode->Node().mode |= HOST_ENDIAN_TO_BFS_INT32(S_STR_INDEX);
|
||||||
|
|
||||||
BPlusTree* tree = fInode->fTree
|
BPlusTree* tree = new(std::nothrow) BPlusTree(*fTransaction, fInode);
|
||||||
= new(std::nothrow) BPlusTree(*fTransaction, fInode);
|
if (tree == NULL)
|
||||||
if (tree == NULL || tree->InitCheck() < B_OK)
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
|
status_t status = tree->InitCheck();
|
||||||
|
if (status != B_OK) {
|
||||||
|
delete tree;
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
fInode->fTree = tree;
|
||||||
|
|
||||||
if (fInode->IsRegularNode()) {
|
if (fInode->IsRegularNode()) {
|
||||||
if (tree->Insert(*fTransaction, ".", fInode->ID()) < B_OK
|
if (tree->Insert(*fTransaction, ".", fInode->ID()) < B_OK
|
||||||
|| tree->Insert(*fTransaction, "..",
|
|| tree->Insert(*fTransaction, "..",
|
||||||
|
|||||||
Reference in New Issue
Block a user