about summary refs log tree commit diff
path: root/src/libstore/store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/store.cc')
-rw-r--r--src/libstore/store.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index d85b0608f409..a89e4ed89fa7 100644
--- a/src/libstore/store.cc
+++ b/src/libstore/store.cc
@@ -160,13 +160,14 @@ void copyPath(const Path & src, const Path & dst)
 static bool isInStore(const Path & path)
 {
     return path[0] == '/'
-        && Path(path, 0, nixStore.size()) == nixStore
-        && path.size() > nixStore.size() + 1
-        && path[nixStore.size()] == '/';
+        && path.compare(0, nixStore.size(), nixStore) == 0
+        && path.size() >= nixStore.size() + 2
+        && path[nixStore.size()] == '/'
+        && path.find('/', nixStore.size() + 1) == Path::npos;
 }
 
 
-static void assertStorePath(const Path & path)
+void assertStorePath(const Path & path)
 {
     if (!isInStore(path))
         throw Error(format("path `%1%' is not in the Nix store") % path);