[libvirt] [PATCH v2 4/4] util: Check for negative indent in virBufferAdd

Martin Kletzander mkletzan at redhat.com
Wed Jan 16 10:15:59 UTC 2013


On 01/15/2013 07:12 PM, John Ferlan wrote:
> ---
>  src/util/virbuffer.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
> index 969dcbf..693e4b2 100644
> --- a/src/util/virbuffer.c
> +++ b/src/util/virbuffer.c
> @@ -153,10 +153,9 @@ virBufferAdd(virBufferPtr buf, const char *str, int len)
>      if (!str || !buf || (len == 0 && buf->indent == 0))
>          return;
>  
> -    if (buf->error)
> -        return;
> -
>      indent = virBufferGetIndent(buf, true);
> +    if (indent < 0)
> +        return;
>  
>      if (len < 0)
>          len = strlen(str);
> 

ACK && Pushed with a little explanation taken from 0/4:

Since virBufferGetIndent() will check and fail on buf->error, I removed
that check from virBufferAdd() and used the -1 return as the way to exit.

Hope that's OK,

Martin




More information about the libvir-list mailing list