From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROWfQ-0001up-EG for qemu-devel@nongnu.org; Thu, 10 Nov 2011 10:35:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROWfP-0006cS-4m for qemu-devel@nongnu.org; Thu, 10 Nov 2011 10:35:52 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 10 Nov 2011 16:35:32 +0100 Message-Id: <1320939332-31871-1-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] vl.c: Fail gracefully if no machine is found List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= 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=C3=A4rber --- 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 =3D CONFIG_QEMU_DATADIR; } =20 + if (machine =3D=3D NULL) { + fprintf(stderr, "No machine found.\n"); + exit(1); + } + /* * Default to max_cpus =3D smp_cpus, in case the user doesn't * specify a max_cpus value. --=20 1.7.7