summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-03-16 12:08:10 -0500
committerDan McGee <dan@archlinux.org>2012-03-16 12:08:10 -0500
commite6f72c61a098b52ea29e54b8eb4739a2ff81e6b0 (patch)
treef04692879dc63fe9f958500ebd646eb169d32fe4 /lib
parent573bd80f147ce90f21ef51fb8ca6f71e89cc3a74 (diff)
parentf988aa6b32503f5d4003b1402089df74adf8b485 (diff)
Merge branch 'maint'
Conflicts: lib/libalpm/sync.c
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/dload.c5
-rw-r--r--lib/libalpm/sync.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 05988065..b3ac024c 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -390,6 +390,11 @@ static int curl_download_internal(struct dload_payload *payload,
CURL *curl = get_libcurl_handle(handle);
handle->pm_errno = 0;
+ /* make sure these are NULL */
+ FREE(payload->tempfile_name);
+ FREE(payload->destfile_name);
+ FREE(payload->content_disp_name);
+
payload->tempfile_openmode = "wb";
if(!payload->remote_name) {
STRDUP(payload->remote_name, get_filename(payload->fileurl),
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index e84679a0..ab7fe319 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -864,6 +864,9 @@ static int download_single_file(alpm_handle_t *handle, struct dload_payload *pay
{
const alpm_list_t *server;
+ payload->handle = handle;
+ payload->allow_resume = 1;
+
for(server = payload->servers; server; server = server->next) {
const char *server_url = server->data;
size_t len;
@@ -872,12 +875,13 @@ static int download_single_file(alpm_handle_t *handle, struct dload_payload *pay
len = strlen(server_url) + strlen(payload->remote_name) + 2;
MALLOC(payload->fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
snprintf(payload->fileurl, len, "%s/%s", server_url, payload->remote_name);
- payload->handle = handle;
- payload->allow_resume = 1;
if(_alpm_download(payload, cachedir, NULL) != -1) {
return 0;
}
+
+ free(payload->fileurl);
+ payload->unlink_on_fail = 0;
}
return -1;