[Libosinfo] [libosinfo PATCH] tests: get the curl response code every time

Pavel Hrdina phrdina at redhat.com
Wed Nov 1 13:35:16 UTC 2017


This failed on FreeBSD with following error:

../../tests/test-mediauris.c:47:13: error: variable 'response_code' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 tests/test-mediauris.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/test-mediauris.c b/tests/test-mediauris.c
index 5ac2c8e..a079f46 100644
--- a/tests/test-mediauris.c
+++ b/tests/test-mediauris.c
@@ -44,9 +44,7 @@ static void test_media(OsinfoMediaList *medialist, GError **error, CURL *curl)
         g_test_message("%s", url);
         curl_easy_setopt(curl, CURLOPT_URL, url);
         res = curl_easy_perform(curl);
-        if (res != CURLE_OK) {
-            curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
-        }
+        curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
 
         g_test_message("res=%d, %s; code=%ld", res, curl_easy_strerror(res), response_code);
         g_assert_cmpint(res, ==, CURLE_OK);
-- 
2.13.6




More information about the Libosinfo mailing list