diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 5f8a5f4cbb..48fc51cf87 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -928,6 +928,12 @@ void qemuMonitorClose(qemuMonitorPtr mon) virCondSignal(&mon->notify); } + /* Propagate existing monitor error in case the current thread has no + * error set. + */ + if (mon->lastError.code != VIR_ERR_OK && !virGetLastError()) + virSetError(&mon->lastError); + virObjectUnlock(mon); virObjectUnref(mon); }