Skip to content

Commit

Permalink
urlget: Print errno message when fwrite() fails (issue #12)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlj committed May 4, 2017
1 parent 153afdf commit 092624b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/urlget.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ int urlget_buffer(const char *url, void *user_data,

curl_easy_cleanup(easyhandle);

if (success) {
fprintf(stderr, "Error retrieving %s: %s\n", url, errbuf);
if (success != CURLE_OK) {
if (success == CURLE_WRITE_ERROR) {
fprintf(stderr, "Error retrieving %s: %s: ", url, errbuf);
perror(NULL);
fprintf(stderr, "\n");
} else
fprintf(stderr, "Error retrieving %s: %s\n", url, errbuf);

ret = 1;
}
} else
Expand Down

0 comments on commit 092624b

Please sign in to comment.