From patchwork Thu Nov 10 15:35:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 124909 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1AA5E1007D1 for ; Fri, 11 Nov 2011 02:36:06 +1100 (EST) Received: from localhost ([::1]:43090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROWfZ-0001uu-FP for incoming@patchwork.ozlabs.org; Thu, 10 Nov 2011 10:36:01 -0500 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 Received: from fmmailgate03.web.de ([217.72.192.234]:59802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROWfO-0006cG-Uy; Thu, 10 Nov 2011 10:35:51 -0500 Received: from moweb002.kundenserver.de (moweb002.kundenserver.de [172.19.20.108]) by fmmailgate03.web.de (Postfix) with ESMTP id DDB681AA51020; Thu, 10 Nov 2011 16:35:48 +0100 (CET) Received: from localhost.localdomain ([2.39.114.236]) by smtp.web.de (mrweb001) with ESMTPA (Nemesis) id 0Mbhiv-1RgsKX0V7N-00J2rG; Thu, 10 Nov 2011 16:35:48 +0100 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 10 Nov 2011 16:35:32 +0100 Message-Id: <1320939332-31871-1-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.7.7 MIME-Version: 1.0 X-Provags-ID: V02:K0:aNa2Ptn1nkmTOoV2vs5S3LzyFOm6GGVRUyRgRi6W4CH j9Nsc2WbEjr7e0Z6sFBgqfs26rsBiNda7YLc8ATbxWJjkW9S6U 2tg5gs69l2nUdFqUYLaXhXJ2WEIGIwqtOneyUKz7UDQzszpmeA g9BVVcEGjTgWCgVLSlaYZJ0z5kkd5BNgnqxokSCpa+sTonGfD/ BVyQFeyVg5idck4gl98Fw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 217.72.192.234 Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH] vl.c: Fail gracefully if no machine is found X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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.