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

Re: [libvirt] [PATCH 8/9] util: Implement virRun as a wrapper around virCommand



On 05/13/2011 02:10 PM, Cole Robinson wrote:
> v2:
>     Simplify command building
>     Handle command building failure
> 
> Signed-off-by: Cole Robinson <crobinso redhat com>
> ---
>  src/util/util.c |   74 ++++--------------------------------------------------
>  1 files changed, 6 insertions(+), 68 deletions(-)

fun 1:11 ratio

> +    int ret;
> +    virCommandPtr cmd = virCommandNewArgs(argv);
>  
> -    ret = 0;
> +    if (!cmd)
> +        return -1;

You should not add these two lines.  Why? Because you didn't report the
OOM error,

>  
> -  error:
> -    VIR_FREE(outbuf);
> -    VIR_FREE(errbuf);
> -    VIR_FORCE_CLOSE(outfd);
> -    VIR_FORCE_CLOSE(errfd);
> +    ret = virCommandRun(cmd, status);

but this safely handles NULL cmd on input and correctly reports the OOM
error.

ACK with that buglet fixed.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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