mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
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:
parent
f340964dc9
commit
077cd91773
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user