qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] patch vl.c, segfault with "qemu -h"


From: Marion Hakanson
Subject: [Qemu-devel] patch vl.c, segfault with "qemu -h"
Date: Fri, 29 Jun 2007 11:48:52 -0700

When you run "qemu -h", help() is called with optarg==NULL, which
causes a segfault on my system (Solaris-10U3_x86, 64-bit kernel,
but qemu compiled as 32-bit app, gcc-3.4.5 from blastwave.org).
It's a side-effect of the -r1.315 patch which fixed related segfaults.

The following patch fixes the "-h" segfault, and also appears to yield
the exit value intended by previous folks.

===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.316
diff -u -r1.316 vl.c
--- vl.c        28 Jun 2007 15:14:49 -0000      1.316
+++ vl.c        29 Jun 2007 18:40:57 -0000
@@ -6712,7 +6712,7 @@
 #endif
            DEFAULT_GDBSTUB_PORT,
            "/tmp/qemu.log");
-    exit(strcmp(optarg, "?"));
+    exit((optarg != NULL) && strcmp(optarg, "?"));
 }

 #define HAS_ARG 0x0001
===================================================================

Regards,

Marion






reply via email to

[Prev in Thread] Current Thread [Next in Thread]