lib/curl: Only check individual request errors
authorColin Walters <walters@verbum.org>
Mon, 31 Jul 2017 14:48:57 +0000 (10:48 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 2 Aug 2017 15:44:00 +0000 (15:44 +0000)
It looks like `curl_multi_socket_action()` will return an error
if *one* of the requests has an error, but we already check
for that explicitly by iterating over each handle.

In libcurl, the "easy" layer doesn't really make use of this
return value.  I did a bit of looking elsewhere; systemd
does check it as a runtime error, not an assertion.  librepo
doesn't use the multi interface.

Closes: https://github.com/ostreedev/ostree/issues/1035
Closes: #1038
Approved by: jlebon

src/libostree/ostree-fetcher-curl.c

index ae8bea73ae43c4b36bc72980a8c031b287b2d221..57118f9c8146ac3bfe11f9790cec4031155915d9 100644 (file)
@@ -425,11 +425,9 @@ static gboolean
 timer_cb (gpointer data)
 {
   OstreeFetcher *fetcher = data;
-  CURLMcode rc;
   GSource *orig_src = fetcher->timer_event;
 
-  rc = curl_multi_socket_action (fetcher->multi, CURL_SOCKET_TIMEOUT, 0, &fetcher->curl_running);
-  g_assert (rc == CURLM_OK);
+  (void)curl_multi_socket_action (fetcher->multi, CURL_SOCKET_TIMEOUT, 0, &fetcher->curl_running);
   check_multi_info (fetcher);
   if (fetcher->timer_event == orig_src)
     fetcher->timer_event = NULL;
@@ -460,15 +458,12 @@ static gboolean
 event_cb (int fd, GIOCondition condition, gpointer data)
 {
   OstreeFetcher *fetcher = data;
-  CURLMcode rc;
 
   int action =
     (condition & G_IO_IN ? CURL_CSELECT_IN : 0) |
     (condition & G_IO_OUT ? CURL_CSELECT_OUT : 0);
 
-  rc = curl_multi_socket_action (fetcher->multi, fd, action, &fetcher->curl_running);
-  g_assert (rc == CURLM_OK);
-
+  (void)curl_multi_socket_action (fetcher->multi, fd, action, &fetcher->curl_running);
   check_multi_info (fetcher);
   if (fetcher->curl_running > 0)
     {