When comparing paths, we need to ensure that the entry's path does in fact have a path separator at the same position as the original, otherwise we incorrectly indicate containment in some cases. Fixes ticket #3186.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28754 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2008-12-01 14:08:53 +00:00
parent 5acaa0fe30
commit 6020e8a4c3
+7 -1
View File
@@ -508,7 +508,13 @@ BDirectory::Contains(const BEntry *entry, int32 nodeFlags) const
if (dirPath.InitCheck() != B_OK || entryPath.InitCheck() != B_OK)
return false;
return !strncmp(dirPath.Path(), entryPath.Path(), strlen(dirPath.Path()));
uint32 dirLen = strlen(dirPath.Path());
if (!strncmp(dirPath.Path(), entryPath.Path(), dirLen)) {
if (strlen(entryPath.Path()) > dirLen && entryPath.Path()[dirLen] == '/')
return true;
}
return false;
}