From 308a25c22b51dd54715b717b705191899f07845a Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Thu, 11 Apr 2019 17:51:04 -0500 Subject: [PATCH] Fixed an off by one error in some brittle path manipulation. Need robustify that once we figure out the bigger problems. --- src/IOCoordinator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/IOCoordinator.cpp b/src/IOCoordinator.cpp index 794e7d766..48dff76d1 100755 --- a/src/IOCoordinator.cpp +++ b/src/IOCoordinator.cpp @@ -579,7 +579,7 @@ void IOCoordinator::deleteMetaFile(const bf::path &file) // this is kind of ugly. We need to lock on 'file' relative to metaPath, and without the .meta extension string pita = file.string(); - pita = pita.substr(metaPath.string().length() + 1); + pita = pita.substr(metaPath.string().length()); pita = pita.substr(0, pita.find_last_of('.')); ScopedWriteLock lock(this, pita); @@ -1043,6 +1043,7 @@ void IOCoordinator::readLock(const string &filename) boost::unique_lock s(lockMutex); //cout << "read-locking " << filename << endl; + assert(filename[0] == '/'); auto ins = locks.insert(pair(filename, NULL)); if (ins.second) ins.first->second = new RWLock(); @@ -1067,6 +1068,7 @@ void IOCoordinator::writeLock(const string &filename) boost::unique_lock s(lockMutex); //cout << "write-locking " << filename << endl; + assert(filename[0] == '/'); auto ins = locks.insert(pair(filename, NULL)); if (ins.second) ins.first->second = new RWLock();