We definitely have a bug here, but this is not the right fix. The bug
is that the cleanup: label is trying to read from logfd if the vm
crashed, without having opened logfd in the qemuProcessAttach case.
I think the more appropriate patch is this:
diff --git i/src/qemu/qemu_process.c w/src/qemu/qemu_process.c
index 8508ff6..1eea45f 100644
--- i/src/qemu/qemu_process.c
+++ w/src/qemu/qemu_process.c
@@ -1214,7 +1214,7 @@ qemuProcessWaitForMonitor(struct qemud_driver*
driver,
cleanup:
virHashFree(paths);
- if (kill(vm->pid, 0) == -1 && errno == ESRCH) {
+ if (pos != -1 && kill(vm->pid, 0) == -1 && errno == ESRCH) {
/* VM is dead, any other error raised in the interim is probably
* not as important as the qemu cmdline output */
qemuProcessReadLogFD(logfd, buf, buf_size, strlen(buf));
Agree, it indeed is a issue, I will check 'null pointer' issue with
thiis fixed again, to avoid some warning from ccc-analyzer, if you set
up this env, please also check it.