Daniel P. Berrangé <[email protected]> writes:

> The vreport() function will print to HMP if available, otherwise
> to stderr. In the event that vreport() is called during execution
> of a QMP command, it will print to stderr, but mistakenly omit the
> message prefixes (timestamp, guest name, program name).
>
> Signed-off-by: Daniel P. Berrangé <[email protected]>
> ---
>  util/error-report.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/util/error-report.c b/util/error-report.c
> index b262ad01cb..872158ad90 100644
> --- a/util/error-report.c
> +++ b/util/error-report.c
> @@ -159,7 +159,7 @@ static void print_loc(void)
   /*
    * Print current location to current monitor if we have one, else to stderr.

This comment is now wrong.  Obvious fix: "to current HMP monitor".

Losely related: "[PATCH 0/3] Doc fixes around "current monitor" printing".

    */
   static void print_loc(void)
   {
       const char *sep = "";
>      int i;
>      const char *const *argp;
>  
> -    if (!monitor_cur() && g_get_prgname()) {
> +    if (!monitor_cur_is_hmp() && g_get_prgname()) {
>          error_printf("%s:", g_get_prgname());
>          sep = " ";
>      }
> @@ -203,14 +203,14 @@ static void vreport(report_type type, const char *fmt, 
> va_list ap)
   /*
    * Print a message to current monitor if we have one, else to stderr.

Likewise.

    * @report_type is the type of message: error, warning or informational.
    * Format arguments like vsprintf().  The resulting message should be
    * a single phrase, with no newline or trailing punctuation.
    * Prepend the current location and append a newline.
    */
   G_GNUC_PRINTF(2, 0)
   static void vreport(report_type type, const char *fmt, va_list ap)
>  {
>      gchar *timestr;
>  
> -    if (message_with_timestamp && !monitor_cur()) {
> +    if (message_with_timestamp && !monitor_cur_is_hmp()) {
>          timestr = real_time_iso8601();
>          error_printf("%s ", timestr);
>          g_free(timestr);
>      }
>  
>      /* Only prepend guest name if -msg guest-name and -name guest=... are 
> set */
> -    if (error_with_guestname && error_guest_name && !monitor_cur()) {
> +    if (error_with_guestname && error_guest_name && !monitor_cur_is_hmp()) {
>          error_printf("%s ", error_guest_name);
>      }

Reply via email to