From 2205fc4adb69a6466b1faa1f085a95bdca071145 Mon Sep 17 00:00:00 2001 From: Matthew Almond Date: Thu, 11 Mar 2021 10:41:23 -0800 Subject: [PATCH] Return "calculated" checksum if requested w/caching 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 --- librepo/checksum.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/librepo/checksum.c b/librepo/checksum.c index 47e594675..6b092f7c4 100644 --- a/librepo/checksum.c +++ b/librepo/checksum.c @@ -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 {