Skip to content

Commit

Permalink
Merge pull request NixOS#7503 from edolstra/fix-dirOf
Browse files Browse the repository at this point in the history
Fix CanonPath::dirOf() returning a string_view of a temporary
  • Loading branch information
edolstra authored Dec 23, 2022
2 parents c9eee5a + 64c60f7 commit 14f7dae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libutil/canon-path.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14f7dae

Please sign in to comment.