From 29d43bf96a3e5886f1b32c78bbb16d1507bd0d9e Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 20 Jan 2020 16:06:42 +0100 Subject: [PATCH] qemu: monitor: Improve error message when QEMU reply is too large Don't use ERANGE as it doesn't make much sense in the error message. Also point out that the reply from qemu was too large which is not obvious from the original error: error: No complete monitor response found in 10485760 bytes: Numerical result out of range The new message will read: error: internal error: QEMU monitor reply exceeds buffer size (10485760 bytes) Signed-off-by: Peter Krempa Reviewed-by: Jiri Denemark --- src/qemu/qemu_monitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ccd20b3740..e3bd000ccb 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -484,9 +484,9 @@ qemuMonitorIORead(qemuMonitorPtr mon) if (avail < 1024) { if (mon->bufferLength >= QEMU_MONITOR_MAX_RESPONSE) { - virReportSystemError(ERANGE, - _("No complete monitor response found in %d bytes"), - QEMU_MONITOR_MAX_RESPONSE); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("QEMU monitor reply exceeds buffer size (%d bytes)"), + QEMU_MONITOR_MAX_RESPONSE); return -1; } if (VIR_REALLOC_N(mon->buffer,