curl: Assert that curl_multi_assign worked
authorColin Walters <walters@verbum.org>
Wed, 18 Sep 2024 17:21:27 +0000 (13:21 -0400)
committerSimon McVittie <smcv@debian.org>
Thu, 19 Sep 2024 08:57:08 +0000 (09:57 +0100)
ref https://github.com/ostreedev/ostree/issues/3299

This won't fix that issue, but *if* this assertion triggers
it should give us a better idea of the possible codepaths
where it is happening.

Signed-off-by: Colin Walters <walters@verbum.org>
Origin: upstream, 2024.8, commit:472d9d493a3e4a08415da4c337a7e831e0c5a5e2
Bug-Debian: https://bugs.debian.org/1082121

Gbp-Pq: Name curl-Assert-that-curl_multi_assign-worked.patch

src/libostree/ostree-fetcher-curl.c

index d6902893ff1dc162876b1d26fdd6453fac281007..5808c451b470c5f145f46d58e2a5a289f2abd76a 100644 (file)
@@ -517,7 +517,8 @@ addsock (curl_socket_t s, CURL *easy, int action, OstreeFetcher *fetcher)
   fdp->refcount = 1;
   fdp->fetcher = fetcher;
   setsock (fdp, s, action, fetcher);
-  curl_multi_assign (fetcher->multi, s, fdp);
+  CURLMcode rc = curl_multi_assign (fetcher->multi, s, fdp);
+  g_assert_cmpint (rc, ==, CURLM_OK);
   g_hash_table_add (fetcher->sockets, fdp);
 }