diff options
author | Ludovic Courtès <ludo@gnu.org> | 2021-11-23 11:22:30 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-11-23 11:29:38 +0100 |
commit | b15e543d303ea58fdc0f0541c708389f9d513e3d (patch) | |
tree | 5c4bd48d67d4d3cd4806269dcabf58382f448bed /nix | |
parent | 4efc08d895274ee39e6e6e5c49121fb05a0281b6 (diff) | |
parent | daf7b5ecef8de0e536ffd8d2957f022d010767a8 (diff) | |
download | guix-b15e543d303ea58fdc0f0541c708389f9d513e3d.tar.gz |
Merge branch 'master' into core-updates-frozen
Diffstat (limited to 'nix')
-rw-r--r-- | nix/libutil/util.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc index 69f1c634a9..4d3780e3c2 100644 --- a/nix/libutil/util.cc +++ b/nix/libutil/util.cc @@ -337,12 +337,15 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed, size for (auto & i : readDirectory(path)) _deletePath(path + "/" + i.name, bytesFreed, linkThreshold); } + + int ret; + ret = S_ISDIR(st.st_mode) ? rmdir(path.c_str()) : unlink(path.c_str()); + if (ret == -1) + throw SysError(format("cannot unlink `%1%'") % path); + #undef st_mode #undef st_size #undef st_nlink - - if (remove(path.c_str()) == -1) - throw SysError(format("cannot unlink `%1%'") % path); } |