Check curl error to string

FossilOrigin-Name: 0903e3561f02cf9f2730313cce10a65f91095cec93915a790b6253c166960d18
This commit is contained in:
me@ow.nekobit.net 2022-03-31 11:10:40 +00:00
parent 6f5bdf2ee1
commit 237078adc0
2 changed files with 5 additions and 3 deletions

View file

@ -49,7 +49,7 @@ int mastodont_fetch_curl(mastodont_t* mstdnt,
struct mstdnt_fetch_results* results,
CURLoption request_t)
{
int res;
int res = 3;
char token[TOKEN_STR_SIZE] = { 0 };
struct curl_slist* list = NULL;

View file

@ -21,7 +21,7 @@
int mastodont_request(mastodont_t* data, struct mastodont_request_args* args)
{
int res = 0;
int res = 0, curlerror = 0;
struct mstdnt_storage* storage = args->storage;
struct mstdnt_fetch_results results = { 0 };
char* post;
@ -39,9 +39,11 @@ int mastodont_request(mastodont_t* data, struct mastodont_request_args* args)
curl_easy_setopt(data->curl, CURLOPT_POSTFIELDS, post);
}
if (mastodont_fetch_curl(data, url_query, &results, args->request_type) != CURLE_OK)
curlerror = mastodont_fetch_curl(data, url_query, &results, args->request_type);
if (curlerror != CURLE_OK)
{
res = 1;
storage->error = (char*)curl_easy_strerror(curlerror);
goto cleanup;
}