summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
authorXavier Chantry <shiningxc@gmail.com>2009-07-20 17:23:19 +0200
committerDan McGee <dan@archlinux.org>2009-07-20 23:38:15 +0200
commit344ced22c347b347b55818bb93579ffa2eb9c70b (patch)
tree17b594152639e1f59cca1a79ff4a4ac076937335 /lib/libalpm/add.c
parent60b6cde637338657e72312aef1ff1d04314df745 (diff)
downloadpacman-344ced22c347b347b55818bb93579ffa2eb9c70b.tar.gz
pacman-344ced22c347b347b55818bb93579ffa2eb9c70b.tar.xz
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 <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r--lib/libalpm/add.c7
1 files 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 */