Don't assume buffered output echoes the command.

The if ((nlptr...)) implicitly assumes commptr != NULL (and that "buf"
starts with "cmd").  Make the assumption explicit, it will be broken in
a future patch.

* src/qemu_driver.c: Don't assume buffered monitor output echoes the
  command.
This commit is contained in:
Miloslav Trmač 2009-07-21 11:33:24 +02:00 committed by Daniel P. Berrange
parent f340964dc9
commit 077cd91773

View File

@ -2473,10 +2473,11 @@ qemudMonitorCommandExtra(const virDomainObjPtr vm,
* occurence, and inbetween the command and the newline starting
* the response
*/
if ((commptr = strstr(buf, cmd)))
if ((commptr = strstr(buf, cmd))) {
memmove(buf, commptr, strlen(commptr)+1);
if ((nlptr = strchr(buf, '\n')))
memmove(buf+strlen(cmd), nlptr, strlen(nlptr)+1);
if ((nlptr = strchr(buf, '\n')))
memmove(buf+strlen(cmd), nlptr, strlen(nlptr)+1);
}
break;
}