Blame SOURCES/0156-ureport-improve-curl-s-error-messages.patch

562801
From b3d0e0225d155744f5aece391db31644dd7bd83a Mon Sep 17 00:00:00 2001
562801
From: Matej Habrnal <mhabrnal@redhat.com>
562801
Date: Wed, 16 Sep 2015 14:44:31 +0200
562801
Subject: [PATCH] ureport: improve curl's error messages
562801
562801
There were cases the 'post_state->errmsg' was empty and error message looks
562801
like "Failed to upload uReport to the server 'https://localhost:12345/faf' with
562801
curl:". This is kind of confusing because there is no information related to
562801
curl error part.  In the case the 'post_state->errmsg' is empty, error message
562801
without "with curl:" part will be printed. Also print information stored in
562801
'post_state->curl_error_msg', if is not empty.
562801
562801
Now, in the case the 'post_state->errmsg' is empty, the error message may look
562801
like this:
562801
Failed to upload uReport to the server 'https://localhost:12345/faf'
562801
Error: curl_easy_perform: Problem with the SSL CA cert (path? access rights?)
562801
562801
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
562801
---
562801
 src/lib/ureport.c | 11 ++++++++++-
562801
 1 file changed, 10 insertions(+), 1 deletion(-)
562801
562801
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
562801
index 76bcc95..ebeaa8b 100644
562801
--- a/src/lib/ureport.c
562801
+++ b/src/lib/ureport.c
562801
@@ -566,7 +566,16 @@ ureport_server_response_from_reply(post_state_t *post_state,
562801
      */
562801
     if (post_state->curl_result != CURLE_OK)
562801
     {
562801
-        error_msg(_("Failed to upload uReport to the server '%s' with curl: %s"), config->ur_url, post_state->errmsg);
562801
+        if (post_state->errmsg != NULL && strcmp( post_state->errmsg, "") != 0)
562801
+            error_msg(_("Failed to upload uReport to the server '%s' with curl: %s"),
562801
+                                                                    config->ur_url,
562801
+                                                                    post_state->errmsg);
562801
+        else
562801
+            error_msg(_("Failed to upload uReport to the server '%s'"), config->ur_url);
562801
+
562801
+        if (post_state->curl_error_msg != NULL && strcmp(post_state->curl_error_msg, "") != 0)
562801
+            error_msg(_("Error: %s"), post_state->curl_error_msg);
562801
+
562801
         return NULL;
562801
     }
562801
 
562801
-- 
562801
2.4.3
562801