[pacman-dev] [PATCH v3 4/4] pacman/upgrade: Bail early on errors
Sören Brinkmann
soeren.brinkmann at gmail.com
Tue Mar 11 22:29:23 EDT 2014
When an error is detected in a loop, immediately bail out and report the
error.
Signed-off-by: Sören Brinkmann <soeren.brinkmann at gmail.com>
---
src/pacman/upgrade.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 5ad08216ff06..b85b0c4a4ee1 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -64,6 +64,7 @@ int pacman_upgrade(alpm_list_t *targets)
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n",
(char *)i->data, alpm_strerror(alpm_errno(config->handle)));
retval = 1;
+ break;
} else {
free(i->data);
i->data = str;
@@ -101,14 +102,14 @@ int pacman_upgrade(alpm_list_t *targets)
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n",
targ, alpm_strerror(alpm_errno(config->handle)));
retval = 1;
- continue;
+ break;
}
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);
retval = 1;
- continue;
+ break;
}
config->explicit_adds = alpm_list_add(config->explicit_adds, pkg);
}
--
1.9.0
More information about the pacman-dev
mailing list