From 9cd3f8d0bf1de0873590c08ffaf07a59da351c16 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Fri, 26 Jun 2020 13:40:45 +0200 Subject: [PATCH] bin/xbps-fetch: fix printing uninitialized shasum in error cases --- bin/xbps-fetch/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/xbps-fetch/main.c b/bin/xbps-fetch/main.c index 86622653..bf1d1485 100644 --- a/bin/xbps-fetch/main.c +++ b/bin/xbps-fetch/main.c @@ -161,18 +161,18 @@ main(int argc, char **argv) } if (rv == -1) { - fprintf(stderr, "%s: %s\n", argv[i], xbps_fetch_error_string()); + xbps_error_printf("%s: failed to fetch: %s: %s\n", + progname, argv[i], xbps_fetch_error_string()); + continue; } else if (rv == 0) { fprintf(stderr, "%s: file is identical with remote.\n", argv[i]); if (shasum) { if (!xbps_file_sha256_raw(digest, sizeof digest, filename)) { - xbps_error_printf("%s: failed to hash libxbps: %s: %s\n", - progname, filename, strerror(rv)); - *digest = '\0'; + xbps_error_printf("%s: failed to hash: %s: %s\n", + progname, filename, strerror(rv)); + continue; } } - } else { - rv = 0; } if (shasum) { print_digest(digest, SHA256_DIGEST_LENGTH);