diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-12-23 16:17:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-23 16:17:48 +0100 |
commit | 14f7dae3e4eb0c34192d0077383a7f2a2d630129 (patch) | |
tree | 9ca19ac230357fff658d313882e03b6b896d8f4f /src | |
parent | c9eee5a84d91e974b09623e01d12586e7026f1ce (diff) | |
parent | 64c60f7241217cf4ba652f6502935ac7d523fb55 (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.hh | 2 |
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 |