]> git.proxmox.com Git - mirror_qemu.git/commitdiff
vl: Use error_report() for --display errors
authorMarkus Armbruster <armbru@redhat.com>
Fri, 13 Feb 2015 17:23:45 +0000 (18:23 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 22 Jun 2015 16:20:39 +0000 (18:20 +0200)
Results in nicer error messages.  Before this patch:

    Invalid GTK option string: gtk,lirum-larum

After:

    qemu-system-x86_64: -display gtk,lirum-larum: Invalid GTK option string

Of course, the thing ought to use QemuOpts instead of parsing by hand.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
vl.c

diff --git a/vl.c b/vl.c
index 54ef869fe30b13f0f1bb754717449e2442bd8286..33b0d86fc3af7be14f33f178eb009bc2fde8520c 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2098,13 +2098,13 @@ static DisplayType select_display(const char *p)
                 }
             } else {
             invalid_sdl_args:
-                fprintf(stderr, "Invalid SDL option string: %s\n", p);
+                error_report("Invalid SDL option string");
                 exit(1);
             }
             opts = nextopt;
         }
 #else
-        fprintf(stderr, "SDL support is disabled\n");
+        error_report("SDL support is disabled");
         exit(1);
 #endif
     } else if (strstart(p, "vnc", &opts)) {
@@ -2115,18 +2115,18 @@ static DisplayType select_display(const char *p)
                 exit(1);
             }
         } else {
-            fprintf(stderr, "VNC requires a display argument vnc=<display>\n");
+            error_report("VNC requires a display argument vnc=<display>");
             exit(1);
         }
 #else
-        fprintf(stderr, "VNC support is disabled\n");
+        error_report("VNC support is disabled");
         exit(1);
 #endif
     } else if (strstart(p, "curses", &opts)) {
 #ifdef CONFIG_CURSES
         display = DT_CURSES;
 #else
-        fprintf(stderr, "Curses support is disabled\n");
+        error_report("Curses support is disabled");
         exit(1);
 #endif
     } else if (strstart(p, "gtk", &opts)) {
@@ -2155,19 +2155,19 @@ static DisplayType select_display(const char *p)
                 }
             } else {
             invalid_gtk_args:
-                fprintf(stderr, "Invalid GTK option string: %s\n", p);
+                error_report("Invalid GTK option string");
                 exit(1);
             }
             opts = nextopt;
         }
 #else
-        fprintf(stderr, "GTK support is disabled\n");
+        error_report("GTK support is disabled");
         exit(1);
 #endif
     } else if (strstart(p, "none", &opts)) {
         display = DT_NONE;
     } else {
-        fprintf(stderr, "Unknown display type: %s\n", p);
+        error_report("Unknown display type");
         exit(1);
     }