summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-08-19 14:07:29 -0400
committerDan McGee <dan@archlinux.org>2011-08-19 19:00:58 -0500
commit82fc816d790ac8b2bfaa81575bf85067769ece10 (patch)
tree051d595f5a96f58fab5836d2e942b5620004cfee /lib
parent43940f591ed77f984c49fe8a3629d66dbf78bfb0 (diff)
downloadpacman-82fc816d790ac8b2bfaa81575bf85067769ece10.tar.xz
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/dload.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index c8f52c48..98a7cf85 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -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"),