We must not check the node here.

* The node might not be a normal tree node, so we must not check it before
  writing.
* Also, it's always a good idea to check if the function you called didn't
  succeed.
* This fixes a crashing bug when running checkfs in some rare circumstances.
This commit is contained in:
Axel Dörfler 2012-03-31 17:00:02 +02:00
parent e0927e2c44
commit cb8941c48f

View File

@ -776,7 +776,10 @@ BPlusTree::MakeEmpty()
= HOST_ENDIAN_TO_BFS_INT64((uint64)BPLUSTREE_NULL);
}
bplustree_node* node = cached.SetToWritable(transaction, NodeSize());
bplustree_node* node = cached.SetToWritable(transaction, NodeSize(), false);
if (node == NULL)
return B_IO_ERROR;
node->left_link = HOST_ENDIAN_TO_BFS_INT64((uint64)BPLUSTREE_NULL);
node->right_link = HOST_ENDIAN_TO_BFS_INT64((uint64)BPLUSTREE_NULL);
node->overflow_link = HOST_ENDIAN_TO_BFS_INT64((uint64)BPLUSTREE_NULL);