Skip to content

Commit

Permalink
Truncate downloaded file more correctly
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
malmond77 committed Apr 21, 2021
1 parent 4daa959 commit adc4546
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion librepo/downloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down

0 comments on commit adc4546

Please sign in to comment.