2
0

error-printf.c 539 B

1234567891011121314151617181920212223
  1. #include "qemu/osdep.h"
  2. #include "qemu/error-report.h"
  3. #include "monitor/monitor.h"
  4. int error_vprintf(const char *fmt, va_list ap)
  5. {
  6. int ret;
  7. if (g_test_initialized() && !g_test_subprocess() &&
  8. getenv("QTEST_SILENT_ERRORS")) {
  9. char *msg = g_strdup_vprintf(fmt, ap);
  10. g_test_message("%s", msg);
  11. ret = strlen(msg);
  12. g_free(msg);
  13. return ret;
  14. }
  15. return vfprintf(stderr, fmt, ap);
  16. }
  17. int error_vprintf_unless_qmp(const char *fmt, va_list ap)
  18. {
  19. return error_vprintf(fmt, ap);
  20. }