bin/xbps-fetch: exit with failure if there was a failure in any of the downloads

This commit is contained in:
Duncan Overbruck 2020-06-26 13:44:54 +02:00
parent 9cd3f8d0bf
commit 66f84a8b59
No known key found for this signature in database
GPG Key ID: 335C1D17EC3D6E35

View File

@ -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);
}