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>
This commit is contained in:
parent
3b22183a4d
commit
841e531c51
1 changed files with 4 additions and 0 deletions
|
@ -192,13 +192,17 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
|
||||||
if(trans->add == NULL) {
|
if(trans->add == NULL) {
|
||||||
if(_alpm_remove_packages(handle, 1) == -1) {
|
if(_alpm_remove_packages(handle, 1) == -1) {
|
||||||
/* pm_errno is set by _alpm_remove_packages() */
|
/* pm_errno is set by _alpm_remove_packages() */
|
||||||
|
alpm_errno_t save = handle->pm_errno;
|
||||||
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
|
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
|
||||||
|
handle->pm_errno = save;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(_alpm_sync_commit(handle, data) == -1) {
|
if(_alpm_sync_commit(handle, data) == -1) {
|
||||||
/* pm_errno is set by _alpm_sync_commit() */
|
/* pm_errno is set by _alpm_sync_commit() */
|
||||||
|
alpm_errno_t save = handle->pm_errno;
|
||||||
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
|
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
|
||||||
|
handle->pm_errno = save;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue