diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 5f8a5f4cbbb5433d5a473b070090123d72d1cc79..48fc51cf87e722694ffb6ce9e0ef7122da1eb1d5 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); }