[libvirt] [PATCHv2 03/13] virbuf: more detailed error reporting

Peter Krempa pkrempa at redhat.com
Wed Oct 19 10:21:09 UTC 2011


On 09/29/2011 06:22 PM, Eric Blake wrote:
> The next patch wants to add some sanity checking, which would
> be a different error than ENOMEM.  Many existing callers blindly
> report OOM failure if virBuf reports an error, and this will be
> wrong in the (unlikely) case that they actually had a usage error
> instead; but since the most common error really is ENOMEM, I'm
> not going to fix all callers.  Meanwhile, new discriminating
> callers can react differently depending on what failure happened.
>
> * src/util/buf.c (virBufferSetError): Add parameter.
> (virBufferGrow, virBufferVasprintf, virBufferEscapeString)
> (virBufferEscapeSexpr): Adjust callers.
After you rebase to current head, this patch omits to modify
an call instance of virBufferSetError in the newly introduced
function virBufferEscapeShell resulting into:

util/buf.c: In function 'virBufferEscapeShell':
util/buf.c:563: error: too few arguments to function 'virBufferSetError'

I looked trhough all instances of calling virBufferError and found
none, that would check against a constant, so after this patch, everything
should work as it used to. Even if it has now access to a reason of the 
error.

ACK with that fixed

Peter




More information about the libvir-list mailing list