summaryrefslogtreecommitdiffstats
path: root/Source/cmFileMonitor.cxx
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2017-01-11 18:08:04 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-11 18:48:41 (GMT)
commit7bad99b0d3fb50853937d99cd68eb340a0975156 (patch)
tree90bf28e364bd35af2d7ba567cf390c07badd130d /Source/cmFileMonitor.cxx
parent68d13665e023f6ccb51ba0375cabd27e492db483 (diff)
downloadCMake-7bad99b0d3fb50853937d99cd68eb340a0975156.zip
CMake-7bad99b0d3fb50853937d99cd68eb340a0975156.tar.gz
CMake-7bad99b0d3fb50853937d99cd68eb340a0975156.tar.bz2
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 ea37683..815de95 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) {