From 942bb9e64a7ba11e5f2a0db374bcaa21868eceb6 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 7 Feb 2011 21:33:30 -0600 Subject: Skip diskspace checking for symlinks and directories in all cases We did this in some but not all cases, assuming the 0 value coming out of libarchive would not be a problem. However, this does not work for "fake" filesystems such as rpc_pipefs, which reports a free block and total block count of zero. Fix this by not ever counting symlinks or directories, and adding a note explaining that if we someday do count directories, their size needs to be attributed to the proper place. This patch also includes a few cleanups/performance tweaks- avoid calling strlen() on the mountpoint directory string as much by storing this size in our mountpoint struct, and push the snprintf() call up to the calculate functions since we were already doing it here in the remove case. Signed-off-by: Dan McGee --- lib/libalpm/diskspace.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/libalpm/diskspace.h') diff --git a/lib/libalpm/diskspace.h b/lib/libalpm/diskspace.h index 25b9cfbf..ae99d0c8 100644 --- a/lib/libalpm/diskspace.h +++ b/lib/libalpm/diskspace.h @@ -32,6 +32,7 @@ typedef struct __alpm_mountpoint_t { /* mount point information */ char *mount_dir; + size_t mount_dir_len; /* storage for additional disk usage calculations */ long blocks_needed; long max_blocks_needed; -- cgit v1.2.3-24-g4f1b