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

Daniel P. Berrange berrange at redhat.com
Thu Aug 27 17:13:35 UTC 2009


On Thu, Aug 20, 2009 at 08:18:15PM +0200, Miloslav Trma?? wrote:
> 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 eb22940..e92276e 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;
>              }

ACK



Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list