From 7bad99b0d3fb50853937d99cd68eb340a0975156 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 11 Jan 2017 19:08:04 +0100 Subject: [PATCH] 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 --- Source/cmFileMonitor.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx index ea37683bb..815de95e7 100644 --- a/Source/cmFileMonitor.cxx +++ b/Source/cmFileMonitor.cxx @@ -331,6 +331,9 @@ void cmFileMonitor::MonitorPaths(const std::vector& 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) {