aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-12-23 16:17:48 +0100
committerGitHub <noreply@github.com>2022-12-23 16:17:48 +0100
commit14f7dae3e4eb0c34192d0077383a7f2a2d630129 (patch)
tree9ca19ac230357fff658d313882e03b6b896d8f4f /src
parentc9eee5a84d91e974b09623e01d12586e7026f1ce (diff)
parent64c60f7241217cf4ba652f6502935ac7d523fb55 (diff)
Merge pull request #7503 from edolstra/fix-dirOf
Fix CanonPath::dirOf() returning a string_view of a temporary
Diffstat (limited to 'src')
-rw-r--r--src/libutil/canon-path.hh2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/canon-path.hh b/src/libutil/canon-path.hh
index c5e7f0596..9d5984584 100644
--- a/src/libutil/canon-path.hh
+++ b/src/libutil/canon-path.hh
@@ -110,7 +110,7 @@ public:
std::optional<std::string_view> dirOf() const
{
if (isRoot()) return std::nullopt;
- return path.substr(0, path.rfind('/'));
+ return ((std::string_view) path).substr(0, path.rfind('/'));
}
std::optional<std::string_view> baseName() const