From 5f38660be12c898e6ddef0d09b973d259d80c763 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 8 Aug 2011 19:55:44 -0500 Subject: Add reason to corrupted package callback Signed-off-by: Dan McGee --- lib/libalpm/sync.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/libalpm/sync.c') diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 663fca6c..e8605914 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -677,14 +677,16 @@ static int apply_deltas(alpm_handle_t *handle) * * @param trans the transaction * @param filename the absolute path of the file to test + * @param reason an error code indicating the reason for package invalidity * * @return 1 if file was removed, 0 otherwise */ -static int prompt_to_delete(alpm_trans_t *trans, const char *filepath) +static int prompt_to_delete(alpm_trans_t *trans, const char *filepath, + enum _alpm_errno_t reason) { int doremove = 0; QUESTION(trans, ALPM_TRANS_CONV_CORRUPTED_PKG, (char *)filepath, - NULL, NULL, &doremove); + &reason, NULL, &doremove); if(doremove) { unlink(filepath); } @@ -711,7 +713,7 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas, ret = _alpm_test_md5sum(filepath, d->delta_md5); if(ret != 0) { - prompt_to_delete(trans, filepath); + prompt_to_delete(trans, filepath, ALPM_ERR_DLT_INVALID); errors++; *data = alpm_list_add(*data, strdup(d->delta)); } @@ -899,7 +901,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) alpm_pkg_t *pkgfile =_alpm_pkg_load_internal(handle, filepath, 1, spkg->md5sum, spkg->base64_sig, level); if(!pkgfile) { - prompt_to_delete(trans, filepath); + prompt_to_delete(trans, filepath, handle->pm_errno); errors++; *data = alpm_list_add(*data, strdup(filename)); FREE(filepath); -- cgit v1.2.3