[libvirt] [PATCH 17/20] Don't assume buffered output echoes the command.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 412b68d..17de104 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2357,10 +2357,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

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]