From patchwork Mon Oct 12 08:52:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/1] net: fix multiple NICs causing net opts process to stop Date: Sun, 11 Oct 2009 22:52:00 -0000 From: Mark McLoughlin X-Patchwork-Id: 35736 Message-Id: <1255337520-30381-1-git-send-email-markmc@redhat.com> To: qemu-devel@nongnu.org Cc: Mark McLoughlin For NICs, net_init_client() returns the index into the NICInfo table. qemu_opts_foreach() interprets non-zero as an error return an stops iterating over the options. So, if you have more than one '-net nic' on the command line, subsequent '-net' options do not get processed. Fix this by making net_client_init() only return non-zero if net_init_client() returns an error. Reported-by: Peter Lieven Signed-off-by: Mark McLoughlin --- net.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/net.c b/net.c index 2e4dd58..7cee404 100644 --- a/net.c +++ b/net.c @@ -3203,7 +3203,9 @@ static void net_check_clients(void) static int net_init_client(QemuOpts *opts, void *dummy) { - return net_client_init(NULL, opts); + if (net_client_init(NULL, opts) < 0) + return -1; + return 0; } int net_init_clients(void)