Signed-off-by: Dan McGee <[email protected]>
---
 lib/libalpm/sync.c    |   10 ++++++----
 src/pacman/callback.c |    6 ++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 663fca6..e860591 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);
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 237ccea..a8163d0 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -330,8 +330,10 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, 
void *data2,
                        }
                        break;
                case ALPM_TRANS_CONV_CORRUPTED_PKG:
-                       *response = yesno(_(":: File %s is corrupted. Do you 
want to delete it?"),
-                                       (char *)data1);
+                       *response = yesno(_(":: File %s is corrupted (%s).\n"
+                                               "Do you want to delete it?"),
+                                       (char *)data1,
+                                       alpm_strerror(*(enum _alpm_errno_t 
*)data2));
                        break;
        }
        if(config->noask) {
-- 
1.7.6


Reply via email to