mirror of
https://github.com/NixOS/nix.git
synced 2025-11-24 11:19:35 +01:00
Merge pull request #14618 from jonhermansen/freebsd-path-null-terminator
fix(FreeBSD): remove null terminator from executable path
This commit is contained in:
commit
ed176cb42e
1 changed files with 5 additions and 0 deletions
|
|
@ -134,6 +134,11 @@ std::optional<Path> getSelfExe()
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FreeBSD's sysctl(KERN_PROC_PATHNAME) includes the null terminator in
|
||||||
|
// pathLen. Strip it to prevent Nix evaluation errors when the path is
|
||||||
|
// serialized to JSON and evaluated as a Nix string.
|
||||||
|
path.pop_back();
|
||||||
|
|
||||||
return Path(path.begin(), path.end());
|
return Path(path.begin(), path.end());
|
||||||
#else
|
#else
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue