diff options
author | Marius Bakke <mbakke@fastmail.com> | 2020-01-15 00:09:46 +0100 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2020-01-15 00:09:46 +0100 |
commit | 3cfe76bec06fbd8bb7e7cb3387866fefbcad674f (patch) | |
tree | b66780d205fb50fd44d0bbb38f5df99cf3167ba1 /nix/libutil/util.cc | |
parent | ec836b46bf52a5f86c61f50e3a2c3330a7ee3665 (diff) | |
parent | 574a71a7a9668aa184661c58e1f18a4d4fccd792 (diff) | |
download | guix-patches-3cfe76bec06fbd8bb7e7cb3387866fefbcad674f.tar guix-patches-3cfe76bec06fbd8bb7e7cb3387866fefbcad674f.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'nix/libutil/util.cc')
-rw-r--r-- | nix/libutil/util.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc index faba3789df..fb2dfad1f7 100644 --- a/nix/libutil/util.cc +++ b/nix/libutil/util.cc @@ -305,7 +305,7 @@ void writeLine(int fd, string s) } -static void _deletePath(const Path & path, unsigned long long & bytesFreed) +static void _deletePath(const Path & path, unsigned long long & bytesFreed, size_t linkThreshold) { checkInterrupt(); @@ -324,7 +324,7 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed) struct stat st = lstat(path); #endif - if (!S_ISDIR(st.st_mode) && st.st_nlink == 1) + if (!S_ISDIR(st.st_mode) && st.st_nlink <= linkThreshold) bytesFreed += st.st_size; if (S_ISDIR(st.st_mode)) { @@ -335,7 +335,7 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed) } for (auto & i : readDirectory(path)) - _deletePath(path + "/" + i.name, bytesFreed); + _deletePath(path + "/" + i.name, bytesFreed, linkThreshold); } #undef st_mode #undef st_size @@ -353,12 +353,12 @@ void deletePath(const Path & path) } -void deletePath(const Path & path, unsigned long long & bytesFreed) +void deletePath(const Path & path, unsigned long long & bytesFreed, size_t linkThreshold) { startNest(nest, lvlDebug, format("recursively deleting path `%1%'") % path); bytesFreed = 0; - _deletePath(path, bytesFreed); + _deletePath(path, bytesFreed, linkThreshold); } |