mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
dload: zero out pm_errno in curl_download_internal
This reverts some hacky behavior from 5fc3ec and resets the handle's pm_errno where it should be reset -- prior to each download. This prevents a transaction with a download from being aborted when a package is successfully grabbed from a secondary server. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
cea6d7eb13
commit
b008193c12
@ -194,6 +194,7 @@ static int curl_download_internal(struct dload_payload *payload,
|
|||||||
struct sigaction sig_pipe[2], sig_int[2];
|
struct sigaction sig_pipe[2], sig_int[2];
|
||||||
/* shortcut to our handle within the payload */
|
/* shortcut to our handle within the payload */
|
||||||
alpm_handle_t *handle = payload->handle;
|
alpm_handle_t *handle = payload->handle;
|
||||||
|
handle->pm_errno = 0;
|
||||||
|
|
||||||
if(!payload->filename) {
|
if(!payload->filename) {
|
||||||
payload->filename = get_filename(payload->fileurl);
|
payload->filename = get_filename(payload->fileurl);
|
||||||
|
@ -738,11 +738,10 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
|||||||
const char *cachedir;
|
const char *cachedir;
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
alpm_list_t *files = NULL;
|
alpm_list_t *files = NULL;
|
||||||
enum _alpm_errno_t errsv = 0;
|
int errors = 0;
|
||||||
|
|
||||||
cachedir = _alpm_filecache_setup(handle);
|
cachedir = _alpm_filecache_setup(handle);
|
||||||
handle->trans->state = STATE_DOWNLOADING;
|
handle->trans->state = STATE_DOWNLOADING;
|
||||||
handle->pm_errno = 0;
|
|
||||||
|
|
||||||
/* Total progress - figure out the total download size if required to
|
/* 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
|
* pass to the callback. This function is called once, and it is up to the
|
||||||
@ -821,9 +820,9 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
|
errors++;
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files from %s\n"),
|
_alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files from %s\n"),
|
||||||
current->treename);
|
current->treename);
|
||||||
errsv = ALPM_ERR_RETRIEVE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,13 +843,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
|||||||
handle->totaldlcb(0);
|
handle->totaldlcb(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set errno accordingly. an error occuring in the downloader itself will
|
return errors;
|
||||||
* 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)
|
int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
|
||||||
|
Loading…
Reference in New Issue
Block a user