Received: from eggs.gnu.org ([2001:4830:134:3::10]:50631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrr6E-0008Hs-HU for qemu-devel@nongnu.org; Thu, 29 Oct 2015 13:34:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zrr6B-0001SW-9V for qemu-devel@nongnu.org; Thu, 29 Oct 2015 13:34:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrr6B-0001SD-1y for qemu-devel@nongnu.org; Thu, 29 Oct 2015 13:34:51 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id C1E9AC0AEE2B for ; Thu, 29 Oct 2015 17:34:50 +0000 (UTC) From: Markus Armbruster References: <1446057425-16891-1-git-send-email-ehabkost@redhat.com> <1446057425-16891-2-git-send-email-ehabkost@redhat.com> Date: Thu, 29 Oct 2015 18:34:48 +0100 In-Reply-To: <1446057425-16891-2-git-send-email-ehabkost@redhat.com> (Eduardo Habkost's message of "Wed, 28 Oct 2015 16:36:50 -0200") Message-ID: <87bnbhvarr.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 01/16] vl.c: Replace fprintf(stderr) with error_report() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Paolo Bonzini , Andrew Jones , qemu-devel@nongnu.org Eduardo Habkost writes: > Replace most fprintf(stderr) calls on vl.c with error_report(). > > Minimal changes were made in the error messages. Only the trailing > newlines, "qemu:" and "error:" message prefixes were removed. > > The only remaining fprintf(stderr) calls are the ones at > qemu_kill_report(), because the error mesage is split in multiple > fprintf() calls. > > Reviewed-by: Markus Armbruster > Reviewed-by: Eric Blake > Signed-off-by: Eduardo Habkost > --- > Changes v1 -> v2: > * Indentation fix at "No machine specified" error message > --- > vl.c | 228 +++++++++++++++++++++++++++++++++---------------------------------- > 1 file changed, 112 insertions(+), 116 deletions(-) > > diff --git a/vl.c b/vl.c > index f5f7c3f..25b91fc 100644 > --- a/vl.c > +++ b/vl.c > @@ -674,9 +674,9 @@ void runstate_set(RunState new_state) > assert(new_state < RUN_STATE_MAX); > > if (!runstate_valid_transitions[current_run_state][new_state]) { > - fprintf(stderr, "ERROR: invalid runstate transition: '%s' -> '%s'\n", > - RunState_lookup[current_run_state], > - RunState_lookup[new_state]); > + error_report("invalid runstate transition: '%s' -> '%s'", > + RunState_lookup[current_run_state], > + RunState_lookup[new_state]); > abort(); > } > trace_runstate_set(new_state); > @@ -828,8 +828,8 @@ static void configure_rtc_date_offset(const char *startdate, int legacy) > rtc_start_date = mktimegm(&tm); > if (rtc_start_date == -1) { > date_fail: > - fprintf(stderr, "Invalid date format. Valid formats are:\n" > - "'2006-06-17T16:01:21' or '2006-06-17'\n"); > + error_report("Invalid date format. Valid formats are:\n" > + "'2006-06-17T16:01:21' or '2006-06-17'"); I'm afraid you violate error_report()'s contract: /* * Print an error message to current monitor if we have one, else to stderr. * Format arguments like sprintf(). The result should not contain * newlines. * Prepend the current location and append a newline. * It's wrong to call this in a QMP monitor. Use error_setg() there. */ Make it something like error_report("invalid date format"); error_printf("valid formats: '2006-06-17T16:01:21'" " or '2006-06-17'\n"); > exit(1); > } > rtc_date_offset = qemu_time() - rtc_start_date; [...]