From 7e2a47c7bb2378ae1c61cce86227eb23ea06f7e0 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 6 Feb 2024 06:09:26 -0500 Subject: Gracefully handle a failure to download a file --- src/artifactory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/artifactory.c b/src/artifactory.c index c44c95f..0c73b69 100644 --- a/src/artifactory.c +++ b/src/artifactory.c @@ -57,9 +57,11 @@ int artifactory_download_cli(char *dest, fprintf(stderr, "%s: %s: %s", __FUNCTION__, path, strerror(errno)); return -1; } + sprintf(path + strlen(path), "/%s", remote_filename); - if (download(url, path)) { + if (HTTP_ERROR(download(url, path, NULL))) { fprintf(stderr, "%s: download failed: %s\n", __FUNCTION__, url); + return -1; } chmod(path, 0755); return 0; -- cgit