Skip to content

Commit 16767e6

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 566400a commit 16767e6

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
@@ -1687,7 +1687,7 @@ prepare_next_transfer(LrDownload *dd, gboolean *candidatefound, GError **err)
16871687

16881688
// Allow resume only for files that were originally being
16891689
// downloaded by librepo
1690-
if (target->resume && !has_librepo_xattr(fd)) {
1690+
if (!(target->resume && has_librepo_xattr(fd))) {
16911691
target->resume = FALSE;
16921692
g_debug("%s: Resume ignored, existing file was not originally "
16931693
"being downloaded by Librepo", __func__);

0 commit comments

Comments
 (0)