Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkLcO-0002CX-Ie for qemu-devel@nongnu.org; Wed, 24 Feb 2010 13:05:52 -0500 Received: from [199.232.76.173] (port=52968 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkLcN-0002Bx-P7 for qemu-devel@nongnu.org; Wed, 24 Feb 2010 13:05:51 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkLcG-0000Rj-9u for qemu-devel@nongnu.org; Wed, 24 Feb 2010 13:05:50 -0500 Received: from mx20.gnu.org ([199.232.41.8]:5316) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NkLcC-0000Qp-CB for qemu-devel@nongnu.org; Wed, 24 Feb 2010 13:05:40 -0500 Received: from oxygen.pond.sub.org ([213.239.205.148]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NkLcA-00017i-9z for qemu-devel@nongnu.org; Wed, 24 Feb 2010 13:05:38 -0500 Received: from blackfin.pond.sub.org (pD9E38C12.dip.t-dialin.net [217.227.140.18]) by oxygen.pond.sub.org (Postfix) with ESMTPA id B98312DD2C6 for ; Wed, 24 Feb 2010 18:56:02 +0100 (CET) From: Markus Armbruster Date: Wed, 24 Feb 2010 18:55:17 +0100 Message-Id: <1267034160-3517-6-git-send-email-armbru@redhat.com> In-Reply-To: <1267034160-3517-1-git-send-email-armbru@redhat.com> References: <1267034160-3517-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH RFC 05/48] pc: Fix error reporting for -boot once List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Commit 0ecdffbb created pc_boot_set() for use from monitor command "boot_set", via qemu_boot_set(). pc_boot_set() reports errors to cur_mon, which works fine for monitor code. Commit e0f084bf reused the function int reset handler restore_boot_devices(). Use of cur_mon is problematic in that context. For instance, the "Too many boot devices for PC" error for "-boot order=abcdefgh,once=c" goes to the monitor instead of stderr. The monitor may not even exist. Fix by switching to qemu_error(). Signed-off-by: Markus Armbruster --- hw/pc.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 4f6a522..d94980b 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -234,7 +234,6 @@ static int boot_device2nibble(char boot_device) and used there as well */ static int pc_boot_set(void *opaque, const char *boot_device) { - Monitor *mon = cur_mon; #define PC_MAX_BOOT_DEVICES 3 RTCState *s = (RTCState *)opaque; int nbds, bds[3] = { 0, }; @@ -242,14 +241,14 @@ static int pc_boot_set(void *opaque, const char *boot_device) nbds = strlen(boot_device); if (nbds > PC_MAX_BOOT_DEVICES) { - monitor_printf(mon, "Too many boot devices for PC\n"); + qemu_error("Too many boot devices for PC\n"); return(1); } for (i = 0; i < nbds; i++) { bds[i] = boot_device2nibble(boot_device[i]); if (bds[i] == 0) { - monitor_printf(mon, "Invalid boot device for PC: '%c'\n", - boot_device[i]); + qemu_error("Invalid boot device for PC: '%c'\n", + boot_device[i]); return(1); } } -- 1.6.6