summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@server-speed.net>2011-05-06 21:38:14 +0200
committerFlorian Pritz <bluewind@server-speed.net>2011-05-06 21:38:40 +0200
commit295c991aeeb95ee76c7b0dfc61e292f895806eae (patch)
tree8233b28c9e66fd7298cb93304eb42ae6ff241732
parent412dc1487390f6fde342a68e025453b3f9c6b5c6 (diff)
handle libcurl errors
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
-rw-r--r--fb-upload.c.in12
1 files changed, 11 insertions, 1 deletions
diff --git a/fb-upload.c.in b/fb-upload.c.in
index 23fa8e0..2baf5f5 100644
--- a/fb-upload.c.in
+++ b/fb-upload.c.in
@@ -157,6 +157,8 @@ int main(int argc, char *argv[])
char *data = NULL;
size_t data_size = 0;
+ int ret = 0;
+
/* simple arg check */
if(argc != 3)
return 1;
@@ -214,12 +216,20 @@ int main(int argc, char *argv[])
gettimeofday(&cb_data.starttime, NULL);
res = curl_easy_perform(curl);
+ if (res != 0) {
+ fprintf(stderr, "\r%s\n", curl_easy_strerror(res));
+ ret = 1;
+ }
+
/* cleanup */
curl_easy_cleanup(curl);
curl_formfree(formpost);
curl_slist_free_all (headerlist);
curl_global_cleanup();
free(data);
+ } else {
+ fprintf(stderr, "Error initializing curl");
+ ret = 1;
}
- return 0;
+ return ret;
}