From 47d0df6c101455c989887551bd0f0149a0f00de7 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Fri, 9 Mar 2012 23:16:40 +1000 Subject: Skip special files when cleaning package cache Ignore *.sig, *.db*, and *.src.tar* when cleaning the package cache. Fixes FS#25166. Signed-off-by: Allan McRae --- src/pacman/sync.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/pacman/sync.c b/src/pacman/sync.c index a9a9e99c..951ee94c 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -224,6 +225,22 @@ static int sync_cleancache(int level) if(strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { continue; } + + /* skip signature files - they are removed with their package file */ + if(fnmatch("*.sig", ent->d_name, 0) == 0) { + continue; + } + + /* skip package database within the cache directory */ + if(fnmatch("*.db*", ent->d_name, 0) == 0) { + continue; + } + + /* skip source packages within the cache directory */ + if(fnmatch("*.src.tar*", ent->d_name, 0) == 0) { + continue; + } + /* build the full filepath */ snprintf(path, PATH_MAX, "%s%s", cachedir, ent->d_name); -- cgit v1.2.3