On 05/31/2013 06:00 AM, Paolo Bonzini wrote:
> Two instances, both spotted by Coverity.  In one, two blocks were
> swapped.  In the other, the check is not needed anymore.
> 
> Cc: qemu-sta...@nongnu.org
> Cc: qemu-triv...@nongnu.org
> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
> ---
>  monitor.c |  2 +-
>  savevm.c  | 10 +++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)

This version of the savevm.c fix is nicer than Stefan's attempt:
https://lists.gnu.org/archive/html/qemu-devel/2013-05/msg04506.html

Reviewed-by: Eric Blake <ebl...@redhat.com>

> +++ b/savevm.c
> @@ -322,16 +322,16 @@ QEMUFile *qemu_popen_cmd(const char *command, const 
> char *mode)
>      FILE *stdio_file;
>      QEMUFileStdio *s;
>  
> -    stdio_file = popen(command, mode);
> -    if (stdio_file == NULL) {
> -        return NULL;
> -    }
> -
>      if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) {
>          fprintf(stderr, "qemu_popen: Argument validity check failed\n");
>          return NULL;
>      }
>  
> +    stdio_file = popen(command, mode);
> +    if (stdio_file == NULL) {
> +        return NULL;
> +    }
> +
>      s = g_malloc0(sizeof(QEMUFileStdio));
>  
>      s->stdio_file = stdio_file;
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to