qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH] vl.c: Fail gracefully if no mach


From: Anthony Liguori
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] vl.c: Fail gracefully if no machine is found
Date: Fri, 11 Nov 2011 13:45:50 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13

On 11/10/2011 09:35 AM, Andreas Färber wrote:
machine defaults to find_default_machine(),
then gets overridden via -M and machine_parse().

If no -M is specified and find_default_machine() returns NULL
(when no machine compiled in), exit with an error.

Avoids a segfault when setting machine->max_cpus.

Signed-off-by: Andreas Färber<address@hidden>

Applied.  Thanks.

Regards,

Anthony Liguori

---
  vl.c |    5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/vl.c b/vl.c
index f169aac..16fa222 100644
--- a/vl.c
+++ b/vl.c
@@ -3089,6 +3089,11 @@ int main(int argc, char **argv, char **envp)
          data_dir = CONFIG_QEMU_DATADIR;
      }

+    if (machine == NULL) {
+        fprintf(stderr, "No machine found.\n");
+        exit(1);
+    }
+
      /*
       * Default to max_cpus = smp_cpus, in case the user doesn't
       * specify a max_cpus value.




reply via email to

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