1
0
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:
Dave Reisner 2011-08-19 14:07:29 -04:00 committed by Dan McGee
parent 43940f591e
commit 82fc816d79

View File

@ -319,6 +319,10 @@ static int curl_download_internal(struct dload_payload *payload,
case CURLE_ABORTED_BY_CALLBACK:
goto cleanup;
default:
/* delete zero length downloads */
if(stat(tempfile, &st) == 0 && st.st_size == 0) {
payload->unlink_on_fail = 1;
}
if(!payload->errors_ok) {
handle->pm_errno = ALPM_ERR_LIBCURL;
_alpm_log(handle, ALPM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),