mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
dload: delete zero length downloads on curl error
In the case of a non-operation (e.g. DNS resolver error), delete the leftover 0 byte .part file. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
43940f591e
commit
82fc816d79
@ -319,6 +319,10 @@ static int curl_download_internal(struct dload_payload *payload,
|
|||||||
case CURLE_ABORTED_BY_CALLBACK:
|
case CURLE_ABORTED_BY_CALLBACK:
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
default:
|
default:
|
||||||
|
/* delete zero length downloads */
|
||||||
|
if(stat(tempfile, &st) == 0 && st.st_size == 0) {
|
||||||
|
payload->unlink_on_fail = 1;
|
||||||
|
}
|
||||||
if(!payload->errors_ok) {
|
if(!payload->errors_ok) {
|
||||||
handle->pm_errno = ALPM_ERR_LIBCURL;
|
handle->pm_errno = ALPM_ERR_LIBCURL;
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
|
||||||
|
Loading…
Reference in New Issue
Block a user