Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/sync.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 3d581661..0c19efed 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -738,10 +738,11 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
const char *cachedir;
alpm_list_t *i, *j;
alpm_list_t *files = NULL;
- int errors = 0;
+ enum _alpm_errno_t errsv = 0;
cachedir = _alpm_filecache_setup(handle);
handle->trans->state = STATE_DOWNLOADING;
+ handle->pm_errno = 0;
/* Total progress - figure out the total download size if required to
* pass to the callback. This function is called once, and it is up to the
@@ -820,21 +821,15 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
}
}
if(ret == -1) {
- errors++;
+ _alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files from %s\n"),
+ current->treename);
+ errsv = ALPM_ERR_RETRIEVE;
}
}
alpm_list_free_inner(files, (alpm_list_fn_free)_alpm_dload_payload_free);
alpm_list_free(files);
files = NULL;
- if(errors) {
- _alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files from %s\n"),
- current->treename);
- if(handle->pm_errno == 0) {
- handle->pm_errno = ALPM_ERR_RETRIEVE;
- }
- return -1;
- }
}
}
@@ -848,7 +843,14 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
if(handle->totaldlcb) {
handle->totaldlcb(0);
}
- return 0;
+
+ /* set errno accordingly. an error occuring in the downloader itself will
+ * take precedence over a general retrieval error */
+ if(handle->pm_errno == 0) {
+ handle->pm_errno = errsv;
+ }
+
+ return handle->pm_errno > 0 ? -1 : 0;
}
int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)