summaryrefslogtreecommitdiff
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-19 20:40:32 -0500
committerDan McGee <dan@archlinux.org>2011-09-20 10:23:11 -0500
commitafdbfc05f771f2c684ee195b46d26b3d08a67085 (patch)
treeb4906677251278e46545e1354676c0ab0f9fe614 /lib/libalpm/sync.c
parent7eb2f0cd151998d36746e2eb14cad2a3f8fb708b (diff)
downloadpacman-afdbfc05f771f2c684ee195b46d26b3d08a67085.tar.xz
Extract an _alpm_pkg_validate_internal() method
_alpm_pkg_load_internal() was becoming a monster. Extract the top bit of the method that dealt with checksum and signature validation into a separate method that should be called before one loads a package to ensure it is valid. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 732e786f..a5281078 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -971,14 +971,20 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
_alpm_log(handle, ALPM_LOG_DEBUG,
"replacing pkgcache entry with package file for target %s\n",
spkg->name);
- alpm_pkg_t *pkgfile =_alpm_pkg_load_internal(handle, filepath, spkg, 1, level);
- if(!pkgfile) {
+ if(_alpm_pkg_validate_internal(handle, filepath, spkg, level) == -1) {
prompt_to_delete(handle, filepath, handle->pm_errno);
errors++;
*data = alpm_list_add(*data, strdup(spkg->filename));
FREE(filepath);
continue;
}
+ alpm_pkg_t *pkgfile =_alpm_pkg_load_internal(handle, filepath, 1);
+ if(!pkgfile) {
+ errors++;
+ *data = alpm_list_add(*data, strdup(spkg->filename));
+ FREE(filepath);
+ continue;
+ }
FREE(filepath);
pkgfile->reason = spkg->reason; /* copy over install reason */
i->data = pkgfile;