Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/dload.c10
-rw-r--r--lib/libalpm/dload.h1
-rw-r--r--lib/libalpm/sync.c4
3 files changed, 12 insertions, 3 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index ccd70d99..e8896098 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -722,4 +722,14 @@ void _alpm_dload_payload_reset(struct dload_payload *payload)
memset(payload, '\0', sizeof(*payload));
}
+void _alpm_dload_payload_reset_for_retry(struct dload_payload *payload)
+{
+ ASSERT(payload, return);
+
+ FREE(payload->fileurl);
+ payload->initial_size += payload->prevprogress;
+ payload->prevprogress = 0;
+ payload->unlink_on_fail = 0;
+}
+
/* vim: set noet: */
diff --git a/lib/libalpm/dload.h b/lib/libalpm/dload.h
index 427c4860..3459665b 100644
--- a/lib/libalpm/dload.h
+++ b/lib/libalpm/dload.h
@@ -47,6 +47,7 @@ struct dload_payload {
};
void _alpm_dload_payload_reset(struct dload_payload *payload);
+void _alpm_dload_payload_reset_for_retry(struct dload_payload *payload);
int _alpm_download(struct dload_payload *payload, const char *localpath,
char **final_file, const char **final_url);
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 837639d4..d3be09e4 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -946,9 +946,7 @@ static int download_single_file(alpm_handle_t *handle, struct dload_payload *pay
EVENT(handle, &event);
return 0;
}
-
- FREE(payload->fileurl);
- payload->unlink_on_fail = 0;
+ _alpm_dload_payload_reset_for_retry(payload);
}
event.type = ALPM_EVENT_PKGDOWNLOAD_FAILED;