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>
This commit is contained in:
Xavier Chantry 2009-07-20 17:23:19 +02:00 committed by Dan McGee
parent 60b6cde637
commit 344ced22c3
1 changed files with 5 additions and 2 deletions

View File

@ -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 */