bin/xbps-fetch: exit with failure if there was a failure in any of the downloads
This commit is contained in:
parent
9cd3f8d0bf
commit
66f84a8b59
@ -86,6 +86,7 @@ int
|
|||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int flags = 0, c = 0, rv = 0;
|
int flags = 0, c = 0, rv = 0;
|
||||||
|
bool failure = false;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
bool shasum = false;
|
bool shasum = false;
|
||||||
struct xbps_handle xh = { 0 };
|
struct xbps_handle xh = { 0 };
|
||||||
@ -163,13 +164,15 @@ main(int argc, char **argv)
|
|||||||
if (rv == -1) {
|
if (rv == -1) {
|
||||||
xbps_error_printf("%s: failed to fetch: %s: %s\n",
|
xbps_error_printf("%s: failed to fetch: %s: %s\n",
|
||||||
progname, argv[i], xbps_fetch_error_string());
|
progname, argv[i], xbps_fetch_error_string());
|
||||||
|
failure = true;
|
||||||
continue;
|
continue;
|
||||||
} else if (rv == 0) {
|
} else if (rv == -1) {
|
||||||
fprintf(stderr, "%s: file is identical with remote.\n", argv[i]);
|
fprintf(stderr, "%s: file is identical with remote.\n", argv[i]);
|
||||||
if (shasum) {
|
if (shasum) {
|
||||||
if (!xbps_file_sha256_raw(digest, sizeof digest, filename)) {
|
if (!xbps_file_sha256_raw(digest, sizeof digest, filename)) {
|
||||||
xbps_error_printf("%s: failed to hash: %s: %s\n",
|
xbps_error_printf("%s: failed to hash: %s: %s\n",
|
||||||
progname, filename, strerror(rv));
|
progname, filename, strerror(rv));
|
||||||
|
failure = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,5 +184,5 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
xbps_end(&xh);
|
xbps_end(&xh);
|
||||||
exit(rv ? EXIT_FAILURE : EXIT_SUCCESS);
|
exit(failure ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user