From bba8009c7538a5b6e07bef44b3b7c6fa7acf7f41 Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Mon, 19 Aug 2019 13:37:10 -0500 Subject: [PATCH] Checkpointing a possible insanity-fix to Ownership. --- storage-manager/src/Ownership.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/storage-manager/src/Ownership.cpp b/storage-manager/src/Ownership.cpp index 3d033049f..f2ef62de9 100644 --- a/storage-manager/src/Ownership.cpp +++ b/storage-manager/src/Ownership.cpp @@ -75,7 +75,7 @@ bf::path Ownership::get(const bf::path &p) { bf::path ret, prefix, normalizedPath(p); bf::path::const_iterator pit; - uint i; + uint i, levels; normalizedPath.normalize(); //cerr << "Ownership::get() param = " << p.string() << endl; @@ -86,13 +86,15 @@ bf::path Ownership::get(const bf::path &p) if (pit != normalizedPath.end()) prefix = *pit; //cerr << "prefix is " << prefix.string() << endl; - for (; pit != normalizedPath.end(); ++pit) + for (levels = 0; pit != normalizedPath.end(); ++levels, ++pit) ret /= *pit; if (ret.empty()) { //cerr << "returning ''" << endl; return ret; } + else if (levels == 1) + throw runtime_error("Ownership: given path " + p.string() + " does not have minimum number of directories"); } else {