diff options
author | Allan McRae <allan@archlinux.org> | 2016-02-21 09:31:35 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2016-02-26 06:18:43 +0100 |
commit | af5d69d59d2deb44bf21bb3f3d9587ec656bbc62 (patch) | |
tree | 53a73f22fe34dd5c44ed134a8a90574490c6a07c | |
parent | 3da06c3519ad8df60ce8c067cdaeddb69a320a53 (diff) | |
download | pacman-af5d69d59d2deb44bf21bb3f3d9587ec656bbc62.tar.gz pacman-af5d69d59d2deb44bf21bb3f3d9587ec656bbc62.tar.xz |
Failed database downloads cause transaction to stop
Previously, we errored only if all databases failed to download. If any
database downloads fail, we are unable to determine whether an update is
still considered safe. So now if any database download fails, the transaction
is aborted (after attempting all database downloads).
Fixes FS#47599.
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r-- | src/pacman/util.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c index e2c99003..0862de0c 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -147,7 +147,7 @@ int check_syncdbs(size_t need_repos, int check_valid) int sync_syncdbs(int level, alpm_list_t *syncs) { alpm_list_t *i; - unsigned int success = 0; + unsigned int success = 1; for(i = syncs; i; i = alpm_list_next(i)) { alpm_db_t *db = i->data; @@ -156,21 +156,14 @@ int sync_syncdbs(int level, alpm_list_t *syncs) if(ret < 0) { pm_printf(ALPM_LOG_ERROR, _("failed to update %s (%s)\n"), alpm_db_get_name(db), alpm_strerror(alpm_errno(config->handle))); + success = 0; } else if(ret == 1) { printf(_(" %s is up to date\n"), alpm_db_get_name(db)); - success++; - } else { - success++; } } - /* We should always succeed if at least one DB was upgraded - we may possibly - * fail later with unresolved deps, but that should be rare, and would be - * expected - */ if(!success) { - pm_printf(ALPM_LOG_ERROR, _("failed to synchronize any databases\n")); - trans_init_error(); + pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases\n")); } return (success > 0); } |