From 3f953c833c5a467d51b8479b38e4305612677695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 12 Aug 2008 15:15:02 +0000 Subject: [PATCH] Added clarifying comment for something that puzzled me at first. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26946 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/storage/PathMonitor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/kits/storage/PathMonitor.cpp b/src/kits/storage/PathMonitor.cpp index ac5ecc249b..36d1815095 100644 --- a/src/kits/storage/PathMonitor.cpp +++ b/src/kits/storage/PathMonitor.cpp @@ -558,7 +558,13 @@ PathHandler::_IsContained(BEntry& entry) const bool contained = strncmp(path.Path(), fPath.Path(), fPathLength) == 0; if (!contained) return false; - + + // Prevent the case that the entry is in another folder which happens + // to have the same substring for fPathLength chars, like: + // /path/we/are/watching + // /path/we/are/watching-not/subfolder/entry + // NOTE: We wouldn't be here if path.Path() was shorter than fPathLength, + // strncmp() catches that case. const char* last = &path.Path()[fPathLength]; if (last[0] && last[0] != '/') return false;