From 66f84a8b59f62b9e1e6cba9d4258851102392cf1 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Fri, 26 Jun 2020 13:44:54 +0200 Subject: [PATCH] bin/xbps-fetch: exit with failure if there was a failure in any of the downloads --- bin/xbps-fetch/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/xbps-fetch/main.c b/bin/xbps-fetch/main.c index bf1d1485..dc7eb0fe 100644 --- a/bin/xbps-fetch/main.c +++ b/bin/xbps-fetch/main.c @@ -86,6 +86,7 @@ int main(int argc, char **argv) { int flags = 0, c = 0, rv = 0; + bool failure = false; bool verbose = false; bool shasum = false; struct xbps_handle xh = { 0 }; @@ -163,13 +164,15 @@ main(int argc, char **argv) if (rv == -1) { xbps_error_printf("%s: failed to fetch: %s: %s\n", progname, argv[i], xbps_fetch_error_string()); + failure = true; continue; - } else if (rv == 0) { + } else if (rv == -1) { 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: %s: %s\n", progname, filename, strerror(rv)); + failure = true; continue; } } @@ -181,5 +184,5 @@ main(int argc, char **argv) } xbps_end(&xh); - exit(rv ? EXIT_FAILURE : EXIT_SUCCESS); + exit(failure ? EXIT_FAILURE : EXIT_SUCCESS); }