summaryrefslogtreecommitdiff
path: root/src/pacman/upgrade.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pacman/upgrade.c')
-rw-r--r--src/pacman/upgrade.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 880aa4c6..87f7c390 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -41,6 +39,7 @@
*/
int pacman_upgrade(alpm_list_t *targets)
{
+ int retval = 0;
alpm_list_t *i;
alpm_siglevel_t level = alpm_option_get_default_siglevel(config->handle);
@@ -57,7 +56,7 @@ int pacman_upgrade(alpm_list_t *targets)
if(str == NULL) {
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n",
(char *)i->data, alpm_strerror(alpm_errno(config->handle)));
- return 1;
+ retval = 1;
} else {
free(i->data);
i->data = str;
@@ -65,6 +64,10 @@ int pacman_upgrade(alpm_list_t *targets)
}
}
+ if(retval) {
+ return retval;
+ }
+
/* Step 1: create a new transaction */
if(trans_init(config->flags, 1) == -1) {
return 1;
@@ -73,25 +76,30 @@ int pacman_upgrade(alpm_list_t *targets)
printf(_("loading packages...\n"));
/* add targets to the created transaction */
for(i = targets; i; i = alpm_list_next(i)) {
- char *targ = alpm_list_getdata(i);
+ const char *targ = i->data;
alpm_pkg_t *pkg;
if(alpm_pkg_load(config->handle, targ, 1, level, &pkg) != 0) {
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n",
targ, alpm_strerror(alpm_errno(config->handle)));
- trans_release();
- return 1;
+ retval = 1;
+ continue;
}
if(alpm_add_pkg(config->handle, pkg) == -1) {
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n",
targ, alpm_strerror(alpm_errno(config->handle)));
alpm_pkg_free(pkg);
- trans_release();
- return 1;
+ retval = 1;
+ continue;
}
config->explicit_adds = alpm_list_add(config->explicit_adds, pkg);
}
+ if(retval) {
+ trans_release();
+ return retval;
+ }
+
/* now that targets are resolved, we can hand it all off to the sync code */
return sync_prepare_execute();
}