diff options
-rw-r--r-- | src/libutil/util.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index b2fe7e627ef1..248095b34296 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -297,8 +297,10 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed, if (lstat(path.c_str(), &st)) throw SysError(format("getting attributes of path `%1%'") % path); - bytesFreed += st.st_size; - blocksFreed += st.st_blocks; + if (!S_ISDIR(st.st_mode) && st.st_nlink == 1) { + bytesFreed += st.st_size; + blocksFreed += st.st_blocks; + } if (S_ISDIR(st.st_mode)) { Strings names = readDirectory(path); |