Stefan Reinauer submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
curl: Handle errors in curl_easy_perform()

Not much we can do, but at least warn the user that something went wrong.

Change-Id: I96374d1b153113a302fa98c27873db863a22f77e
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: https://review.coreboot.org/c/em100/+/37479
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
---
M curl.c
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/curl.c b/curl.c
index 747a98d..d13dfe8 100644
--- a/curl.c
+++ b/curl.c
@@ -110,6 +110,9 @@

/* Fetch the file */
res = curl_easy_perform(curl);
+ if (res != CURLE_OK)
+ printf("Error while downloading %s: %s\n", filename,
+ curl_easy_strerror(res));

/* Close file */
fclose(file);
@@ -117,7 +120,7 @@
/* Clean up */
curl_easy_cleanup(curl);

- return 0;
+ return (res == CURLE_OK) ? 0 : -1;
}

void download(const char *name, const char *id)

To view, visit change 37479. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: em100
Gerrit-Branch: master
Gerrit-Change-Id: I96374d1b153113a302fa98c27873db863a22f77e
Gerrit-Change-Number: 37479
Gerrit-PatchSet: 4
Gerrit-Owner: Stefan Reinauer <stefan.reinauer@coreboot.org>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer@coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged