summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-08-09 02:55:44 +0200
committerDan McGee <dan@archlinux.org>2011-08-09 02:55:44 +0200
commit5f38660be12c898e6ddef0d09b973d259d80c763 (patch)
tree9503aa67599730a4427eb741a8d768b2a5b6173f /lib
parent9d09c9fdf7f6156e81c28045e36970158f26d2f1 (diff)
downloadpacman-5f38660be12c898e6ddef0d09b973d259d80c763.tar.gz
pacman-5f38660be12c898e6ddef0d09b973d259d80c763.tar.xz
Add reason to corrupted package callback
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/sync.c10
1 files changed, 6 insertions, 4 deletions
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);