diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c index 0c4c786b15..bad69bb1fe 100644 --- a/tests/qemucapsprobemock.c +++ b/tests/qemucapsprobemock.c @@ -77,10 +77,14 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon, char *p; bool skip = false; - if (first) + if (first) { first = false; - else + } else { + /* Ignore QMP greeting if it's not the first one */ + if (virJSONValueObjectHasKey(value, "QMP")) + goto cleanup; putchar('\n'); + } for (p = json; *p; p++) { if (skip && *p == '\n') { @@ -92,6 +96,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon, } } + cleanup: VIR_FREE(json); virJSONValueFree(value); return ret;