[pacman-dev] [PATCH v3 4/4] pacman/upgrade: Bail early on errors
Andrew Gregory
andrew.gregory.8 at gmail.com
Wed Mar 12 00:06:56 EDT 2014
On 03/11/14 at 07:29pm, Sören Brinkmann wrote:
> 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(-)
-1. We use retval/continue so that we can give the user errors for
all targets at once instead of making them repeatedly run pacman.
apg
> 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