diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index dcd2dd743a..235773446d 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -474,6 +474,8 @@ qemuMonitorOpen(virDomainObjPtr vm, goto cleanup; } + if (mon->fd == -1) goto cleanup; + if (virSetCloseExec(mon->fd) < 0) { qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to set monitor close-on-exec flag"));