Skip to content

Commit adc4546

Browse files
committed
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 rpm-software-management#222 to work correctly. That does not support resuming (sorry, one day it could), so it explicitly disables resuming.
1 parent 4daa959 commit adc4546

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

librepo/downloader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ prepare_next_transfer(LrDownload *dd, gboolean *candidatefound, GError **err)
15451545

15461546
// Allow resume only for files that were originally being
15471547
// downloaded by librepo
1548-
if (target->resume && !has_librepo_xattr(fd)) {
1548+
if (!(target->resume && has_librepo_xattr(fd))) {
15491549
target->resume = FALSE;
15501550
g_debug("%s: Resume ignored, existing file was not originally "
15511551
"being downloaded by Librepo", __func__);

0 commit comments

Comments
 (0)