diff options
author | Max Reitz <mreitz@redhat.com> | 2019-09-10 14:41:36 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2019-09-16 15:31:12 +0200 |
commit | c34dc07f9f01cf686e512f939aece744723072cd (patch) | |
tree | d31b56df77a3691c15cae0f880e6fadd8cb2f5be /block/curl.c | |
parent | bfb23b480a49114315877aacf700b49453e0f9d9 (diff) |
curl: Check curl_multi_add_handle()'s return code
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 <mreitz@redhat.com>
Message-id: 20190910124136.10565-8-mreitz@redhat.com
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/curl.c')
-rw-r--r-- | block/curl.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/block/curl.c b/block/curl.c index c343c7ed3d..f86299378e 100644 --- a/block/curl.c +++ b/block/curl.c @@ -882,7 +882,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); |