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 4b1aeea..68c2061 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2482,10 +2482,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