[libvirt] [PATCH 6/9] Don't assume buffered output echoes the command.

Miloslav Trmač mitr at redhat.com
Tue Jul 21 11:12:02 UTC 2009


The if ((nlptr...)) implicitly assumes commptr != NULL.  Make the
assumption explicit, it will be broken in a future patch.
---
 src/qemu_driver.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index d2db1a2..f2be27f 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2081,10 +2081,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;
             }
-- 
1.6.2.5




More information about the libvir-list mailing list