From 22be3676809310ce76eb83a61f4f0728a5ec3902 Mon Sep 17 00:00:00 2001 From: hamjin Date: Sun, 8 Sep 2024 23:17:53 +0800 Subject: [PATCH] main: check status in curl_get Signed-off-by: hamjin --- main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.c b/main.c index 63457fc..220872b 100644 --- a/main.c +++ b/main.c @@ -100,6 +100,11 @@ CURLcode curl_get(const char *const url, struct memory *chunk) curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)chunk); status = curl_easy_perform(curl); + if (status != CURLE_OK) + { + fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(status)); + exit(status); + } curl_easy_cleanup(curl); curl_slist_free_all(headers);