mirror of
https://github.com/qemu/qemu.git
synced 2026-04-05 21:50:33 +00:00
util: don't skip error prefixes when QMP is active
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). This new usage of monitor_is_cur_qmp() from vreport() requires that we add a stub to satisfy linking of non-system emulator binaries. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -7,6 +7,11 @@ Monitor *monitor_cur(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool monitor_cur_is_qmp(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
|
||||
{
|
||||
return NULL;
|
||||
|
||||
@@ -74,6 +74,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
|
||||
Monitor *monitor_cur(void) { return cur_mon; }
|
||||
Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { abort(); }
|
||||
int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { abort(); }
|
||||
bool monitor_cur_is_qmp(void) { abort(); };
|
||||
|
||||
#ifndef _WIN32
|
||||
static void test_socket_fd_pass_name_good(void)
|
||||
|
||||
@@ -226,6 +226,14 @@ static void vreport(report_type type, const char *fmt, va_list ap)
|
||||
Monitor *cur = monitor_cur();
|
||||
gchar *timestr;
|
||||
|
||||
/*
|
||||
* When current monitor is QMP, messages must go to stderr
|
||||
* and have prefixes added
|
||||
*/
|
||||
if (monitor_cur_is_qmp()) {
|
||||
cur = NULL;
|
||||
}
|
||||
|
||||
if (message_with_timestamp && !cur) {
|
||||
timestr = real_time_iso8601();
|
||||
fprintf(stderr, "%s ", timestr);
|
||||
|
||||
Reference in New Issue
Block a user