
At 03/29/2011 09:58 PM, Jiri Denemark Write:
On Tue, Mar 29, 2011 at 17:48:48 +0800, Wen Congyang wrote:
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index eed83f4..647e2bb 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -906,7 +906,14 @@ int qemuMonitorSetCapabilities(qemuMonitorPtr mon)
if (mon->json) { ret = qemuMonitorJSONSetCapabilities(mon); - mon->json_hmp = qemuMonitorJSONCheckHMP(mon); + if (ret == 0) { + mon->json_hmp = qemuMonitorJSONCheckHMP(mon); + if (mon->json_hmp < 0) { + /* qemu may quited unexpectedly when we call + * qemuMonitorJSONCheckHMP() */ + ret = -1; + } + }
This shouldn't really work since mon->json_hmp is declared as unsigned json_hmp: 1;
Yes, you are right. Pushed with this fixed. Thanks for reviewing.
I think we need something like
if (ret == 0) { int hmp = qemuMonitorJSONCheckHMP(mon); if (hmp < 0) { ... } else { mon->json_hmp = hmp > 0; } }
Jirka