qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure
@ 2013-03-06 10:48 Kevin Wolf
  2013-03-06 11:04 ` Paolo Bonzini
  2013-03-06 15:05 ` [Qemu-devel] Error ** parameter conventions (was: [PATCH] qemu-sockets: Fix assertion failure) Markus Armbruster
  0 siblings, 2 replies; 24+ messages in thread
From: Kevin Wolf @ 2013-03-06 10:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

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 <kwolf@redhat.com>
---
 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;
         }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2013-03-20 13:52 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-06 10:48 [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure Kevin Wolf
2013-03-06 11:04 ` Paolo Bonzini
2013-03-06 11:11   ` Kevin Wolf
2013-03-06 14:46     ` Laszlo Ersek
2013-03-06 15:04       ` Paolo Bonzini
2013-03-06 15:19         ` Kevin Wolf
2013-03-06 15:38           ` Laszlo Ersek
2013-03-06 15:47             ` Kevin Wolf
2013-03-06 16:04               ` Laszlo Ersek
2013-03-06 15:59           ` Markus Armbruster
2013-03-06 16:43             ` Paolo Bonzini
2013-03-14 14:57             ` [Qemu-devel] [RFC PATCH] qemu-socket: Use local error variable Kevin Wolf
2013-03-14 15:52               ` Laszlo Ersek
2013-03-15  8:37                 ` Kevin Wolf
2013-03-15 16:55                   ` Laszlo Ersek
2013-03-15 17:55                     ` Kevin Wolf
2013-03-15 18:39                       ` Laszlo Ersek
2013-03-19 20:34       ` [Qemu-devel] [PATCH] qemu-sockets: Fix assertion failure Luiz Capitulino
2013-03-20  8:39         ` Kevin Wolf
2013-03-20 12:57           ` Luiz Capitulino
2013-03-20 13:37             ` Kevin Wolf
2013-03-20 13:52               ` Luiz Capitulino
2013-03-06 15:05     ` Markus Armbruster
2013-03-06 15:05 ` [Qemu-devel] Error ** parameter conventions (was: [PATCH] qemu-sockets: Fix assertion failure) Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).