Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/dload.c
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2019-11-15 23:29:20 +1000
committerAllan McRae <allan@archlinux.org>2019-11-15 23:29:20 +1000
commite6a6d3079315ce722fec39604fddbab1c7ac79b3 (patch)
treed82112bd5ad9ea693307c4cf57ce47a25ed70022 /lib/libalpm/dload.c
parentb9faf652735c603d1bdf849a570185eb721f11c1 (diff)
Handle .part files that are the size of the correct package
In rare cases, likely due to a well timed Ctrl+C, but possibly due to a broken mirror, a ".part" file may have size at least that of the correct package size. When encountering this issue, currently pacman fails in different ways depending on where the package falls in the list to download. If last, "wrong or NULL argument passed" error is reported, or a "invalid or corrupt package" issue if not. Capture these .part files, and remove the extension. This lets pacman either use the package if valid, or offer to remove it if it fails checksum or signature verification. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/dload.c')
-rw-r--r--lib/libalpm/dload.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index ddcc45f6..40a1d07d 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -414,6 +414,12 @@ static int curl_download_internal(struct dload_payload *payload,
curl_set_handle_opts(payload, curl, error_buffer);
+ if(payload->max_size == payload->initial_size) {
+ /* .part file is complete */
+ ret = 0;
+ goto cleanup;
+ }
+
if(localf == NULL) {
localf = fopen(payload->tempfile_name, payload->tempfile_openmode);
if(localf == NULL) {