Daniel P. Berrangé <berra...@redhat.com> 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é <berra...@redhat.com> > --- > util/error-report.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/util/error-report.c b/util/error-report.c > index 79b6f23e64..c0fcf388de 100644 > --- a/util/error-report.c > +++ b/util/error-report.c > @@ -34,9 +34,9 @@ const char *error_guest_name; > */ > int error_vprintf(const char *fmt, va_list ap) > { > - Monitor *cur_mon = monitor_cur(); > + Monitor *cur_mon = monitor_cur_hmp(); > > - if (cur_mon && !monitor_cur_is_qmp()) { > + if (cur_mon) { > return monitor_vprintf(cur_mon, fmt, ap); > } > return vfprintf(stderr, fmt, ap);
This isn't part of the fix, it merely puts monitor_cur_hmp() to use. It we decide we want that function (see discussion of previous patch), then I'd squash this hunk into the patch that creates it. > @@ -157,7 +157,7 @@ static void print_loc(void) > int i; > const char *const *argp; > > - if (!monitor_cur() && g_get_prgname()) { > + if (!monitor_cur_hmp() && g_get_prgname()) { > error_printf("%s:", g_get_prgname()); > sep = " "; > } > @@ -201,14 +201,14 @@ 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_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_hmp()) { > error_printf("%s ", error_guest_name); > } Yup, these fix a bug.