about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-11-24T10·51+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-11-24T10·51+0000
commit80220155523fb21c938d595e96597f6511aa7bd0 (patch)
tree19b23d09448161eb47ea3f402375739050fb5465 /src/libutil
parentf9e766db9875e7ab390df8d405d9719b279efe3c (diff)
* In the garbage collector, don't count files with a link count > 1 in
  the "bytes/blocks freed" statistics.

Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/util.cc6
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);