From: Halil Pasic <pasic@linux.vnet.ibm.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 1/1] block: improve error handling in raw_open
Date: Tue, 26 Jul 2016 19:18:27 +0200 [thread overview]
Message-ID: <57979B63.1060505@linux.vnet.ibm.com> (raw)
In-Reply-To: <7c4bdb1e-f0aa-4a07-2780-37f4f92c6665@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]
On 07/26/2016 05:42 PM, Max Reitz wrote:
>> +++ b/block/raw-posix.c
>> > @@ -485,6 +485,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
>> > s->fd = -1;
>> > fd = qemu_open(filename, s->open_flags, 0644);
>> > if (fd < 0) {
>> > + error_setg_errno(errp, errno, "Could not open file");
> We don't guarantee that error_setg_errno() does not modify errno. (In
> practice it should not, but we don't guarantee that.)
>
Thank you very much for your review. I have double checked, and I
remembered correctly: error_setg_errno saves and restores the original
errno, so that is why I assumed it does not.
> Therefore, the common pattern is to save the errno value before calling
> this function, i.e. to put the function call...
>
>> > ret = -errno;
> ...here.
>
> With that fixed, the patch should be good.
>
> Max
>
But now that you have this pointed out, I understand, it is better to
have no function calls between failure and saving the errno. I will post
a v3 and keep this in mind for the future. Sorry for the extra work.
Frankly, I'm a bit uncomfortable with asking (do not want to be pushy),
but do you have an opinion on the 'error_report_err' issue (pointed
out in the cover letter part)?
Cheers,
Halil
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2016-07-26 17:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-18 12:30 [Qemu-devel] [PATCH 1/1] block: improve error handling in raw_open Halil Pasic
2016-07-18 14:41 ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-07-18 15:48 ` Halil Pasic
2016-07-18 15:57 ` Max Reitz
2016-07-18 17:04 ` Halil Pasic
2016-07-22 22:01 ` Max Reitz
2016-07-26 11:34 ` [Qemu-devel] [PATCH v2 " Halil Pasic
2016-07-26 15:42 ` Max Reitz
2016-07-26 17:18 ` Halil Pasic [this message]
2016-07-26 17:47 ` Max Reitz
2016-07-27 12:40 ` Halil Pasic
2016-07-27 14:37 ` Max Reitz
2016-07-27 15:46 ` Halil Pasic
2016-07-27 12:59 ` Markus Armbruster
2016-07-27 14:33 ` Max Reitz
2016-07-26 17:54 ` Max Reitz
2016-07-27 7:55 ` Markus Armbruster
2016-07-26 18:03 ` Sascha Silbe
2016-07-26 18:06 ` Max Reitz
2016-07-26 18:46 ` Sascha Silbe
2016-07-26 18:08 ` [Qemu-devel] [Qemu-block] " John Snow
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=57979B63.1060505@linux.vnet.ibm.com \
--to=pasic@linux.vnet.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--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.