diff options
Diffstat (limited to 'stubs/error-printf.c')
-rw-r--r-- | stubs/error-printf.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/stubs/error-printf.c b/stubs/error-printf.c index 99c6406668..1f9d3b3714 100644 --- a/stubs/error-printf.c +++ b/stubs/error-printf.c @@ -2,19 +2,22 @@ #include "qemu-common.h" #include "qemu/error-report.h" -void error_vprintf(const char *fmt, va_list ap) +int error_vprintf(const char *fmt, va_list ap) { + int ret; + if (g_test_initialized() && !g_test_subprocess() && getenv("QTEST_SILENT_ERRORS")) { char *msg = g_strdup_vprintf(fmt, ap); g_test_message("%s", msg); + ret = strlen(msg); g_free(msg); - } else { - vfprintf(stderr, fmt, ap); + return ret; } + return vfprintf(stderr, fmt, ap); } -void error_vprintf_unless_qmp(const char *fmt, va_list ap) +int error_vprintf_unless_qmp(const char *fmt, va_list ap) { - error_vprintf(fmt, ap); + return error_vprintf(fmt, ap); } |