Skip to content

block/curl: check error return from curl_easy_setopt()

Peter Maydell qemu-devel 2 versions – Applied

Status from this message: Thanks, applied to my block branch:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 5 repliesApplied
  2. v11 patch 5 repliesSuperseded

Changes in v2 from the cover letter

* new patch 1 which fixes a missing "set the error string" for when curl_init_state() returns failure, since we're about to add more cases when that function can fail
* set the error string in the failure path for the direct setopt calls in curl_open()
* fix the failure path in curl_setup_preadv() by putting the curl_easy_setopt() call in the same if() condition as the existing curl_multi_add_handle()

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2block/curl.c: Set error message string if curl_init_state() failsblock/curl.c+2 -02 replies
2/2block/curl.c: Check error return from curl_easy_setopt()block/curl.c+58 -342 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchPhilippe Mathieu-DaudéHanna Reitz
1/2R-b R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] block/curl: check error return from curl_easy_setopt()

Coverity points out that we aren't checking the return value from curl_easy_setopt() for any of the calls to it we make in block/curl.c.

Tested with 'make check' and with some basic smoke test command lines suggested by Dan:

qemu-img info https://cloud.debian.org/images/cloud/buster/daily/latest/debian-10-nocloud-amd64-daily.qcow2
qemu-img info --image-opts driver=qcow2,file.driver=https,file.url=https://cloud.debian.org/images/cloud/buster/daily/latest/debian-10-nocloud-amd64-daily.qcow2

Changes v1->v2:
* new patch 1 which fixes a missing "set the error string" for when curl_init_state() returns failure, since we're about to add more cases when that function can fail
* set the error string in the failure path for the direct setopt calls in curl_open()
* fix the failure path in curl_setup_preadv() by putting the curl_easy_setopt() call in the same if() condition as the existing curl_multi_add_handle()

thanks
-- PMM

Peter Maydell (2):
block/curl.c: Set error message string if curl_init_state() fails block/curl.c: Check error return from curl_easy_setopt()

 block/curl.c | 94 +++++++++++++++++++++++++++++++++-------------------
 1 file changed, 60 insertions(+), 34 deletions(-)
Signature · 1 line
2.25.1