From: Markus Armbruster Date: Wed, 17 Feb 2010 17:05:26 +0000 (+0100) Subject: pc: Fix error reporting for -boot once X-Git-Tag: TizenStudio_2.0_p2.3~5375^2~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ebfaeb0478f86f2b8fd12da3d14613910e231451;p=sdk%2Femulator%2Fqemu.git pc: Fix error reporting for -boot once 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(). --- diff --git a/hw/pc.c b/hw/pc.c index e50a488..0c19043 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); } }