[libvirt] [PATCH] Add helpers for dealing with system errors

Eric Blake eblake at redhat.com
Fri Jul 19 15:23:12 UTC 2013


On 07/19/2013 08:14 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Add virErrorSetErrnoFromLastError and virLastErrorIsSystemErrno
> to simplify code which wants to handle system errors in a more
> graceful fashion.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/libvirt_private.syms |  1 +
>  src/util/virerror.c      | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  src/util/virerror.h      |  4 ++++
>  3 files changed, 53 insertions(+)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 5d39d50..a2b61c7 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1318,6 +1318,7 @@ ebtablesRemoveForwardAllowIn;
>  # util/virerror.h
>  virDispatchError;
>  virErrorInitialize;
> +virLastErrorIsSystemErrno;
>  virRaiseErrorFull;
>  virReportErrorHelper;
>  virReportOOMErrorFull;

Don't you also need to export virErrorSetErrnoFromLastError?

> +
> +/**
> + * virLastErrorIsSystemErrno:
> + * @errnum: the errno value
> + *
> + * Check if the last error reported is a system
> + * error with the specific errno value.
> + *
> + * If @errnum is zero, any system error will pass.
> + *
> + * Returns true if the last errr was a system error with errno == @errnum

s/errr/error/

ACK with those fixes.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130719/59b4cf0b/attachment-0001.sig>


More information about the libvir-list mailing list