summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2015-01-26 13:19:29 -0500
committerAllan McRae <allan@archlinux.org>2015-02-01 21:13:11 +1000
commit841e531c519228b68a447a61d703d21c5ff6d37f (patch)
treea00d4eadc7d5175869ede9efae6d5992946ae0b3 /lib/libalpm
parent3b22183a4d39b410ae7be0b95be6a1cb4704a50c (diff)
downloadpacman-841e531c519228b68a447a61d703d21c5ff6d37f.tar.xz
trans_commit: restore pm_errno after updating log
If the call to alpm_logaction failed it would overwrite pm_errno, leading to error messages unrelated to the actual reason the transaction failed. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/trans.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 7cdb096f..e1caa5e3 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -192,13 +192,17 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
if(trans->add == NULL) {
if(_alpm_remove_packages(handle, 1) == -1) {
/* pm_errno is set by _alpm_remove_packages() */
+ alpm_errno_t save = handle->pm_errno;
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
+ handle->pm_errno = save;
return -1;
}
} else {
if(_alpm_sync_commit(handle, data) == -1) {
/* pm_errno is set by _alpm_sync_commit() */
+ alpm_errno_t save = handle->pm_errno;
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
+ handle->pm_errno = save;
return -1;
}
}