[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/6] curl: Check curl_multi_add_handle()'s return co
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH 6/6] curl: Check curl_multi_add_handle()'s return code |
Date: |
Tue, 27 Aug 2019 18:34:39 +0200 |
If we had done that all along, debugging would have been much simpler.
(Also, I/O errors are better than hangs.)
Signed-off-by: Max Reitz <address@hidden>
---
block/curl.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/block/curl.c b/block/curl.c
index 5e0cca601d..4a7aff02a6 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -894,7 +894,13 @@ static void curl_setup_preadv(BlockDriverState *bs,
CURLAIOCB *acb)
trace_curl_setup_preadv(acb->bytes, start, state->range);
curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range);
- curl_multi_add_handle(s->multi, state->curl);
+ if (curl_multi_add_handle(s->multi, state->curl) != CURLM_OK) {
+ state->acb[0] = NULL;
+ acb->ret = -EIO;
+
+ curl_clean_state(state);
+ goto out;
+ }
/* Tell curl it needs to kick things off */
curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running);
--
2.21.0
- [Qemu-devel] [PATCH 0/6] block/curl: Fix hang and potential crash, Max Reitz, 2019/08/27
- [Qemu-devel] [PATCH 1/6] curl: Keep pointer to the CURLState in CURLSocket, Max Reitz, 2019/08/27
- [Qemu-devel] [PATCH 2/6] curl: Keep *socket until the end of curl_sock_cb(), Max Reitz, 2019/08/27
- [Qemu-devel] [PATCH 3/6] curl: Pass CURLSocket to curl_multi_{do, read}(), Max Reitz, 2019/08/27
- [Qemu-devel] [PATCH 4/6] curl: Report only ready sockets, Max Reitz, 2019/08/27
- [Qemu-devel] [PATCH 5/6] curl: Handle success in multi_check_completion, Max Reitz, 2019/08/27
- [Qemu-devel] [PATCH 6/6] curl: Check curl_multi_add_handle()'s return code,
Max Reitz <=