From e84abff2bd741614f8cb40828f46618d4eb100e4 Mon Sep 17 00:00:00 2001
From: Michael Lotz <mmlr@mlotz.ch>
Date: Sun, 12 Oct 2008 23:02:13 +0000
Subject: [PATCH] Fix strange validity check in BDirectory::Contains(). If
 either path ends up as invalid it must not be used.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28015 a95241bf-73f2-0310-859d-f6bbb57e9c96
---
 src/kits/storage/Directory.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kits/storage/Directory.cpp b/src/kits/storage/Directory.cpp
index 40c82ca635..cc323d1cc9 100644
--- a/src/kits/storage/Directory.cpp
+++ b/src/kits/storage/Directory.cpp
@@ -505,7 +505,7 @@ BDirectory::Contains(const BEntry *entry, int32 nodeFlags) const
 	// the entry and check, if the latter is a prefix of the first one.
 	BPath dirPath(this, ".", true);
 	BPath entryPath(entry);
-	if (dirPath.InitCheck() == B_OK && entryPath.InitCheck() != B_OK)
+	if (dirPath.InitCheck() != B_OK || entryPath.InitCheck() != B_OK)
 		return false;
 
 	return !strncmp(dirPath.Path(), entryPath.Path(), strlen(dirPath.Path()));