From 80220155523fb21c938d595e96597f6511aa7bd0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 24 Nov 2009 10:51:52 +0000 Subject: [PATCH] * In the garbage collector, don't count files with a link count > 1 in the "bytes/blocks freed" statistics. --- src/libutil/util.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libutil/util.cc b/src/libutil/util.cc index b2fe7e627..248095b34 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);