[pacman-dev] [PATCH] calculate_removed_size: ensure llstat succeeds

Allan McRae allan at archlinux.org
Tue Feb 24 15:11:01 UTC 2015


Signed-off-by: Allan McRae <allan at archlinux.org>
---
 lib/libalpm/diskspace.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index 3b496c2..aaa0036 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -235,7 +235,12 @@ static int calculate_removed_size(alpm_handle_t *handle,
 		const char *filename = file->name;
 
 		snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
-		llstat(path, &st);
+
+		if(llstat(path, &st) == -1) {
+			_alpm_log(handle, ALPM_LOG_WARNING,
+					_("could not get file information for %s\n"), filename);
+			continue;
+		}
 
 		/* skip directories and symlinks to be consistent with libarchive that
 		 * reports them to be zero size */
-- 
2.3.0


More information about the pacman-dev mailing list