[libvirt] [PATCH 3/4] Switch libvirtd config loading code to use error APIs

Eric Blake eblake at redhat.com
Fri Apr 6 16:59:37 UTC 2012


On 04/04/2012 08:07 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Using VIR_ERROR means the test suite can't catch error messages
> easily. Use the proper error reporting APIs instead
> ---
>  daemon/libvirtd-config.c |   56 ++++++++++++++++++++++++++++-----------------
>  daemon/libvirtd.c        |    6 ++++-
>  2 files changed, 40 insertions(+), 22 deletions(-)
> 

> +++ b/daemon/libvirtd.c
> @@ -923,7 +923,11 @@ int main(int argc, char **argv) {
>      /* Read the config file if it exists*/
>      if (remote_config_file &&
>          daemonConfigLoadFile(config, remote_config_file, implicit_conf) < 0) {
> -        VIR_ERROR(_("Can't load config file '%s'"), remote_config_file);
> +        virErrorPtr err = virGetLastError();
> +        if (err && err->message)
> +            VIR_ERROR(_("%s"), err->message);

Huh?  _("%s") is useless (no one needs to translate the printf format
that just outputs a string).  This should be

VIR_ERROR("%s", err->message);

ACK with that nit fixed.

-- 
Eric Blake   eblake at 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: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120406/12292598/attachment-0001.sig>


More information about the libvir-list mailing list