From: Miloslav Trmač Date: Tue, 21 Jul 2009 09:33:24 +0000 (+0200) Subject: Don't assume buffered output echoes the command. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=077cd9177398989e6671f8e94adb9d612e1752fb;p=libvirt.git 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. --- diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 3ebe8020e2..ad7b80a8ed 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -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; }