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

Re: [libvirt] [PATCH v2 2/4] tools: Check return status on virBufferTrim()



On 01/15/2013 07:12 PM, John Ferlan wrote:
> ---
>  tools/virsh.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index eadc519..669c9c9 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -536,6 +536,8 @@ vshTreePrintInternal(vshControl *ctl,
>  
>      /* Finally print all children */
>      virBufferAddLit(indent, "  ");
> +    if (virBufferError(indent))
> +        goto cleanup;
>      for (i = 0 ; i < num_devices ; i++) {
>          const char *parent = (lookup)(i, true, opaque);
>  
> @@ -545,15 +547,18 @@ vshTreePrintInternal(vshControl *ctl,
>                                   false, indent) < 0)
>              goto cleanup;
>      }
> -    virBufferTrim(indent, "  ", -1);
> +    if (virBufferTrim(indent, "  ", -1) < 0)
> +        goto cleanup;
>  
>      /* If there was no child device, and we're the last in
>       * a list of devices, then print another blank line */
>      if (nextlastdev == -1 && devid == lastdev)
>          vshPrint(ctl, "%s\n", virBufferCurrentContent(indent));
>  
> -    if (!root)
> -        virBufferTrim(indent, NULL, 2);
> +    if (!root) {
> +        if (virBufferTrim(indent, NULL, 2) < 0)
> +            goto cleanup;
> +    }
>      ret = 0;
>  cleanup:
>      return ret;
> 

ACK && Pushed,

Martin


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