From aa579b843899ccba093f83faa942599ce1110c24 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 6 Jun 2009 11:03:29 -0500 Subject: Give sensible feedback when a repo has no configured servers This fixes FS#14899. When running an -Sp operation without servers configured for a repository, we would segfault, so add an assert to the backend method returning the first server preventing a null pointer dereference. In addition, add a new error code to libalpm that indicates we have no servers configured for a repository. This makes -Sy and -S operations fail gracefully and helpfully when a repo is set up with no servers, as the default mirrorlist in Arch is provided this way. Signed-off-by: Dan McGee --- lib/libalpm/sync.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/libalpm/sync.c') diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 1d42cd9d..6645335b 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -769,7 +769,9 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) if(_alpm_download_files(files, current->servers, cachedir)) { _alpm_log(PM_LOG_WARNING, _("failed to retrieve some files from %s\n"), current->treename); - pm_errno = PM_ERR_RETRIEVE; + if(pm_errno == 0) { + pm_errno = PM_ERR_RETRIEVE; + } goto error; } FREELIST(files); -- cgit v1.2.3-24-g4f1b