diff --git a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp index 47125d67e5..c64c07c3c4 100644 --- a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp @@ -2276,11 +2276,12 @@ BPlusTree::Replace(Transaction& transaction, const uint8* key, uint16 keyLength, status_t BPlusTree::Find(const uint8* key, uint16 keyLength, off_t* _value) { - if (keyLength < BPLUSTREE_MIN_KEY_LENGTH - || keyLength > BPLUSTREE_MAX_KEY_LENGTH - || key == NULL) + if (key == NULL || keyLength < BPLUSTREE_MIN_KEY_LENGTH) RETURN_ERROR(B_BAD_VALUE); + if (keyLength > BPLUSTREE_MAX_KEY_LENGTH) + RETURN_ERROR(B_NAME_TOO_LONG); + if (fAllowDuplicates) RETURN_ERROR(B_BAD_TYPE); diff --git a/src/tests/kits/storage/NodeTest.cpp b/src/tests/kits/storage/NodeTest.cpp index 193a128a2d..5dc8e22fef 100644 --- a/src/tests/kits/storage/NodeTest.cpp +++ b/src/tests/kits/storage/NodeTest.cpp @@ -383,7 +383,7 @@ NodeTest::InitTest1() BDirectory pathDir(dirSuperLink); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BNode node(&pathDir, ""); - CPPUNIT_ASSERT( node.InitCheck() == B_OK ); + CPPUNIT_ASSERT(node.InitCheck() == B_ENTRY_NOT_FOUND); } NextSubTest(); { @@ -564,8 +564,8 @@ NodeTest::InitTest2() // NextSubTest(); CPPUNIT_ASSERT( pathDir.SetTo(dirSuperLink) == B_OK ); - CPPUNIT_ASSERT( node.SetTo(&pathDir, "") == B_OK ); - CPPUNIT_ASSERT( node.InitCheck() == B_OK ); + CPPUNIT_ASSERT(node.SetTo(&pathDir, "") == B_ENTRY_NOT_FOUND); + CPPUNIT_ASSERT(node.InitCheck() == B_ENTRY_NOT_FOUND); // NextSubTest(); CPPUNIT_ASSERT( pathDir.SetTo(existingSuperFile) == B_OK );