mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
Garbage collector: Don't follow symlinks arbitrarily
Only indirect roots (symlinks to symlinks to the Nix store) are now supported.
This commit is contained in:
parent
25a00cae5b
commit
aeb810b01e
5 changed files with 54 additions and 48 deletions
|
@ -148,6 +148,15 @@ string baseNameOf(const Path & path)
|
|||
}
|
||||
|
||||
|
||||
bool isInDir(const Path & path, const Path & dir)
|
||||
{
|
||||
return path[0] == '/'
|
||||
&& string(path, 0, dir.size()) == dir
|
||||
&& path.size() >= dir.size() + 2
|
||||
&& path[dir.size()] == '/';
|
||||
}
|
||||
|
||||
|
||||
struct stat lstat(const Path & path)
|
||||
{
|
||||
struct stat st;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue