main: check status in curl_get

Signed-off-by: hamjin <jinham@qq.com>
This commit is contained in:
hamjin 2024-09-08 23:17:53 +08:00
parent 0e2f615a00
commit 22be367680
Signed by: jinham
GPG Key ID: 4BC3A24E10B95047

5
main.c
View File

@ -100,6 +100,11 @@ CURLcode curl_get(const char *const url, struct memory *chunk)
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)chunk); curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)chunk);
status = curl_easy_perform(curl); 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_easy_cleanup(curl);
curl_slist_free_all(headers); curl_slist_free_all(headers);