From adc45463b73c890fca427be865818018a683af9f Mon Sep 17 00:00:00 2001 From: Matthew Almond Date: Wed, 21 Apr 2021 14:49:06 -0700 Subject: [PATCH] Truncate downloaded file more correctly The previous code would only truncate the file, and turn off resume if the xattr was missing. This left a gap when resume was disabled, and the xattr was missing - the file wouldn't get truncated if present. This behaviour is strictly needed for #222 to work correctly. That does not support resuming (sorry, one day it could), so it explicitly disables resuming. --- librepo/downloader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librepo/downloader.c b/librepo/downloader.c index c5278fbc9..e86326e78 100644 --- a/librepo/downloader.c +++ b/librepo/downloader.c @@ -1545,7 +1545,7 @@ prepare_next_transfer(LrDownload *dd, gboolean *candidatefound, GError **err) // Allow resume only for files that were originally being // downloaded by librepo - if (target->resume && !has_librepo_xattr(fd)) { + if (!(target->resume && has_librepo_xattr(fd))) { target->resume = FALSE; g_debug("%s: Resume ignored, existing file was not originally " "being downloaded by Librepo", __func__);