From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
Qemu-block <qemu-block@nongnu.org>
Subject: Re: block/curl: should we be checking curl_easy_setopt() for errors?
Date: Tue, 31 Aug 2021 09:44:33 +0100 [thread overview]
Message-ID: <YS3r3CceplN2S6se@redhat.com> (raw)
In-Reply-To: <CAFEAcA9YCwrm43JfFE_oenTYnj+vfOHD+Bw4mTHAqOnBgpQX-w@mail.gmail.com>
On Mon, Aug 30, 2021 at 04:34:56PM +0100, Peter Maydell wrote:
> Coverity complains (CID 1460331, 1459482, 1459336, 1458895)
> that we call curl_easy_setopt(), which can return an error value,
> but we never check the return value.
>
> Is it correct? Looking at the libcurl documentation, the function
> does return an error status, and there's nothing that says it's
> ok to ignore (e.g. that it's guaranteed that the library will
> safely accumulate any errors and return them when you make the
> subsequent curl_easy_perform() call). On the other hand, neither
> the libcurl manpage example nor the handful of example programs
> at https://curl.se/libcurl/c/example.html ever seem to check the
> return value from curl_easy_setopt()...
Options that accept a string can return CURLE_OUT_OF_MEMORY from
curl_easy_setopt.Most other failures seem to be reporting caller
errors such as forgotten arguments, or too long strings.
Does look like we ought to check return status though for at
least some of the options, and if you check it for some then
coverity will also complain if you don't check it for all.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2021-08-31 8:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-30 15:34 block/curl: should we be checking curl_easy_setopt() for errors? Peter Maydell
2021-08-31 8:44 ` Daniel P. Berrangé [this message]
2021-08-31 9:56 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YS3r3CceplN2S6se@redhat.com \
--to=berrange@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.