summaryrefslogtreecommitdiff
path: root/Source/cmFileMonitor.cxx
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2017-01-11 19:08:04 +0100
committerBrad King <brad.king@kitware.com>2017-01-11 13:48:41 -0500
commit7bad99b0d3fb50853937d99cd68eb340a0975156 (patch)
tree90bf28e364bd35af2d7ba567cf390c07badd130d /Source/cmFileMonitor.cxx
parent68d13665e023f6ccb51ba0375cabd27e492db483 (diff)
downloadcmake-7bad99b0d3fb50853937d99cd68eb340a0975156.tar.gz
cmake-server: Do not try watching subdirectories with empty names
`cmsys::SystemTools::SplitPath` will return empty segments on paths where there's duplicaded consequent slashes (e.g. `/home/dir/my//stuff`). This makes the cmFileWatcher choke. Teach cmFileMonitor to skip these empty segments. Closes: #16531
Diffstat (limited to 'Source/cmFileMonitor.cxx')
-rw-r--r--Source/cmFileMonitor.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx
index ea37683bb4..815de95e77 100644
--- a/Source/cmFileMonitor.cxx
+++ b/Source/cmFileMonitor.cxx
@@ -331,6 +331,9 @@ void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths,
rootSegment)); // Can not be both filename and root part of the path!
const std::string& currentSegment = pathSegments[i];
+ if (currentSegment.empty()) {
+ continue;
+ }
cmIBaseWatcher* nextWatcher = currentWatcher->Find(currentSegment);
if (!nextWatcher) {