fix(landerctl): output curl error if request fails
ci/woodpecker/push/docker Pipeline was successful Details

release/0.2.0
Jef Roosens 2023-11-17 09:31:20 +01:00
parent e3c3f3b90a
commit 46b404acac
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
2 changed files with 6 additions and 3 deletions

View File

@ -124,6 +124,9 @@ int main(int argc, char **argv) {
curl_easy_setopt(ctx.curl, CURLOPT_HTTPHEADER, ctx.headers);
char curl_err_msg[CURL_ERROR_SIZE];
curl_easy_setopt(ctx.curl, CURLOPT_ERRORBUFFER, curl_err_msg);
int exit_code = 0;
if (curl_easy_perform(ctx.curl) == CURLE_OK) {
@ -145,7 +148,7 @@ int main(int argc, char **argv) {
}
}
} else {
fprintf(stderr, "Libcurl encountered an error.\n");
fprintf(stderr, "Libcurl encountered an error: %s\n", curl_err_msg);
exit_code = 4;
}

View File

@ -112,10 +112,10 @@ landerctl_err landerctl_post_file(landerctl_ctx *ctx) {
ctx->headers = curl_slist_append(ctx->headers, content_type_header);
} else {
printf("Couldn't determine mime type; skipping Content-Type header");
printf("Couldn't determine mime type; skipping Content-Type header\n");
}
} else {
printf("Couldn't load magic file; skipping Content-Type header");
printf("Couldn't load magic file; skipping Content-Type header\n");
}
char s[strlen(ctx->arg) + 1];