Skip to content

Commit

Permalink
Return "calculated" checksum if requested w/caching
Browse files Browse the repository at this point in the history
If a file is downloaded via librepo (e.g. `dnf install --downloadonly`)
then a request to get the checksum via `lr_checksum_fd_compare()` will
not work. It'll only return whether the checksum is valid, and not the
actual checksum. This is the simple fix.

Addresses #233
  • Loading branch information
malmond77 committed Mar 11, 2021
1 parent e44fec3 commit 2205fc4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions librepo/checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ lr_checksum_fd_compare(LrChecksumType type,
g_debug("%s: Using checksum cached in xattr: [%s] %s",
__func__, checksum_key, buf);
*matches = (strcmp(expected, buf) == 0);
if (calculated)
*calculated = g_strdup(checksum);
return TRUE;
}
} else {
Expand Down

0 comments on commit 2205fc4

Please sign in to comment.