From 344ced22c347b347b55818bb93579ffa2eb9c70b Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Mon, 20 Jul 2009 17:23:19 +0200 Subject: Fix one bug with .paccheck leftover file This happens for example if you install a new package, and one of its backup config file is already on the file system. If the local file was different, it was saved to .pacorig which is fine. However if the local file and pkg file were the same, the pkg file (temporarily extracted as .paccheck) was left on the system. Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- lib/libalpm/add.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index ddbcfeea..1b228b2d 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -482,9 +482,9 @@ static int extract_single_file(struct archive *archive, _alpm_log(PM_LOG_DEBUG, "original: %s\n", hash_orig); if(!oldpkg) { - /* looks like we have a local file that has a different hash as the - * file in the package, move it to a .pacorig */ if(strcmp(hash_local, hash_pkg) != 0) { + /* looks like we have a local file that has a different hash as the + * file in the package, move it to a .pacorig */ char newpath[PATH_MAX]; snprintf(newpath, PATH_MAX, "%s.pacorig", filename); @@ -508,6 +508,9 @@ static int extract_single_file(struct archive *archive, alpm_logaction("warning: %s saved as %s\n", filename, newpath); } } + } else { + /* local file is identical to pkg one, so just remove pkg one */ + unlink(checkfile); } } else if(hash_orig) { /* the fun part */ -- cgit v1.2.3-24-g4f1b