aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/util.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 11c75d2cd..178f78bde 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -167,10 +167,11 @@ string baseNameOf(const Path & path)
bool isInDir(const Path & path, const Path & dir)
{
- return path[0] == '/'
- && string(path, 0, dir.size()) == dir
- && path.size() >= dir.size() + 2
- && path[dir.size()] == '/';
+ return dir == "/"
+ || (path[0] == '/'
+ && string(path, 0, dir.size()) == dir
+ && path.size() >= dir.size() + 2
+ && path[dir.size()] == '/');
}