Patchwork [40/44] net: print correct error for '-netdev ""'

login
register
mail settings
Submitter Mark McLoughlin
Date Nov. 25, 2009, 6:49 p.m.
Message ID <1259174977-26212-41-git-send-email-markmc@redhat.com>
Download mbox | patch
Permalink /patch/39440/
State New
Headers show

Comments

Mark McLoughlin - Nov. 25, 2009, 6:49 p.m.
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 net.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

Patch

diff --git a/net.c b/net.c
index c71699d..13bdbb2 100644
--- a/net.c
+++ b/net.c
@@ -1055,12 +1055,18 @@  int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev)
     int i;
 
     type = qemu_opt_get(opts, "type");
-    if (!type) {
-        qemu_error("No type specified for -net\n");
-        return -1;
-    }
 
-    if (is_netdev) {
+    if (!is_netdev) {
+        if (!type) {
+            qemu_error("No type specified for -net\n");
+            return -1;
+        }
+    } else {
+        if (!type) {
+            qemu_error("No type specified for -netdev\n");
+            return -1;
+        }
+
         if (strcmp(type, "tap") != 0 &&
 #ifdef CONFIG_SLIRP
             strcmp(type, "user") != 0 &&