[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure
From: |
Laszlo Ersek |
Subject: |
Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure |
Date: |
Wed, 06 Mar 2013 15:46:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130216 Thunderbird/17.0.3 |
On 03/06/13 12:11, Kevin Wolf wrote:
> Am 06.03.2013 um 12:04 hat Paolo Bonzini geschrieben:
>> Il 06/03/2013 11:48, Kevin Wolf ha scritto:
>>> inet_connect_opts() tries all possible addrinfos returned by
>>> getaddrinfo(). If one fails with an error, the next one is tried. In
>>> this case, the Error should be discarded because the whole operation is
>>> successful if another addrinfo from the list succeeds; and if it
>>> doesn't, setting an already set Error will trigger an assertion failure.
>>>
>>> Signed-off-by: Kevin Wolf <address@hidden>
>>> ---
>>> util/qemu-sockets.c | 8 ++++++++
>>> 1 file changed, 8 insertions(+)
>>>
>>> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
>>> index 1350ccc..32e609a 100644
>>> --- a/util/qemu-sockets.c
>>> +++ b/util/qemu-sockets.c
>>> @@ -373,6 +373,14 @@ int inet_connect_opts(QemuOpts *opts, Error **errp,
>>> }
>>>
>>> for (e = res; e != NULL; e = e->ai_next) {
>>> +
>>> + /* Overwriting errors isn't allowed, so clear any error that may
>>> have
>>> + * occured in the previous iteration */
>>> + if (error_is_set(errp)) {
>>> + error_free(*errp);
>>> + *errp = NULL;
>>> + }
>>> +
>>> if (connect_state != NULL) {
>>> connect_state->current_addr = e;
>>> }
>>>
>>
>> Should we also do nothing if errp is not NULL on entry?
>
> We could assert(!error_is_set(errp)) if we wanted. As soon as you've got
> an Error, you must return instead of calling more functions with the
> same error pointer.
I think Luiz would suggest (*) to receive any error into a
NULL-initialized local_err pointer; do the logic above on local_err, and
just before returning, error_propagate() it to errp.
(*) I hope you can see what I did there: if you disagree, you get to
take that to Luiz, even though he didn't say anything. I'm getting
better at working this list! :)
Laszlo
- [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Kevin Wolf, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Paolo Bonzini, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Kevin Wolf, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure,
Laszlo Ersek <=
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Paolo Bonzini, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Kevin Wolf, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Laszlo Ersek, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Kevin Wolf, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Laszlo Ersek, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Markus Armbruster, 2013/03/06
- Re: [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure, Paolo Bonzini, 2013/03/06
- [Qemu-devel] [RFC PATCH] qemu-socket: Use local error variable, Kevin Wolf, 2013/03/14
- Re: [Qemu-devel] [RFC PATCH] qemu-socket: Use local error variable, Laszlo Ersek, 2013/03/14
- Re: [Qemu-devel] [RFC PATCH] qemu-socket: Use local error variable, Kevin Wolf, 2013/03/15