diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-15 00:46:39 -0400 | 
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-15 01:03:36 -0400 | 
| commit | 34ab33508dae4ecc9bd0b9f272fd005c0ea78b4f (patch) | |
| tree | f26ca5453da5e245c22108e2d8228785d1aff13e | |
| parent | cc935245624c9c8892fd122826dda210d4dab656 (diff) | |
| download | stasis-34ab33508dae4ecc9bd0b9f272fd005c0ea78b4f.tar.gz | |
Apply download() error detection
| -rw-r--r-- | src/artifactory.c | 3 | ||||
| -rw-r--r-- | src/deliverable.c | 3 | 
2 files changed, 4 insertions, 2 deletions
| diff --git a/src/artifactory.c b/src/artifactory.c index 8cc0db5..437912d 100644 --- a/src/artifactory.c +++ b/src/artifactory.c @@ -59,7 +59,8 @@ int artifactory_download_cli(char *dest,      }      sprintf(path + strlen(path), "/%s", remote_filename); -    if (HTTP_ERROR(download(url, path, NULL))) { +    long fetch_status = download(url, path, NULL); +    if (HTTP_ERROR(fetch_status) || fetch_status < 0) {          fprintf(stderr, "%s: download failed: %s\n", __FUNCTION__, url);          return -1;      } diff --git a/src/deliverable.c b/src/deliverable.c index 3b004cd..1640054 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -1180,7 +1180,8 @@ int delivery_get_installer(struct Delivery *ctx, char *installer_url) {      sprintf(script_path, "%s/%s", ctx->storage.tmpdir, installer);      if (access(script_path, F_OK)) {          // Script doesn't exist -        if (HTTP_ERROR(download(installer_url, script_path, NULL))) { +        int fetch_status = download(installer_url, script_path, NULL); +        if (HTTP_ERROR(fetch_status) || fetch_status < 0) {              // download failed              return -1;          } | 
