[libvirt] [PATCH 7/9] remove remainder of offending strerror uses

Daniel P. Berrange berrange at redhat.com
Tue Feb 3 14:01:41 UTC 2009


On Mon, Feb 02, 2009 at 06:08:20PM +0100, Jim Meyering wrote:
> From: Jim Meyering <meyering at redhat.com>
> 
> * qemud/qemud.c (GET_CONF_STR): Use virStrerror, not strerror.
> * qemud/remote.c (remoteDispatchDomainBlockPeek): Likewise.
> (remoteDispatchDomainMemoryPeek, remoteDispatchAuthSaslInit): Likewise.
> (remoteDispatchAuthPolkit): Likewise.
> * src/lxc_container.c (lxcContainerAvailable): Likewise.
> * src/network_driver.c (networkStartNetworkDaemon): Likewise.
> (networkShutdownNetworkDaemon): Likewise.
> * src/qemu_conf.c (qemudExtractVersion, qemudNetworkIfaceConnect):
> * src/storage_conf.c (virStoragePoolLoadAllConfigs): Likewise.
> * src/storage_driver.c (storagePoolUndefine): Likewise.
> * src/uml_driver.c (umlStartup, umlStartVMDaemon): Likewise.
> * src/util.c (virFileReadAll): Likewise.
> * src/uuid.c (virUUIDGenerate): Likewise.
> * src/xen_internal.c (get_cpu_flags): Likewise.

> diff --git a/src/network_driver.c b/src/network_driver.c
> index dcc6ad9..8d7340e 100644
> --- a/src/network_driver.c
> +++ b/src/network_driver.c
> @@ -904,17 +904,18 @@ static int networkStartNetworkDaemon(virConnectPtr conn,
>   err_delbr2:
>      networkRemoveIptablesRules(driver, network);
> 
> - err_delbr1:
> + err_delbr1:;
> +    char ebuf[1024];

A stray ';'  crept in there.

> diff --git a/src/storage_driver.c b/src/storage_driver.c
> index a456061..d644b63 100644
> --- a/src/storage_driver.c
> +++ b/src/storage_driver.c
> @@ -1,7 +1,7 @@
>  /*
>   * storage_driver.c: core driver for storage APIs
>   *
> - * Copyright (C) 2006-2008 Red Hat, Inc.
> + * Copyright (C) 2006-2009 Red Hat, Inc.
>   * Copyright (C) 2006-2008 Daniel P. Berrange
>   *
>   * This library is free software; you can redistribute it and/or
> @@ -567,9 +567,10 @@ storagePoolUndefine(virStoragePoolPtr obj) {
>      if (virStoragePoolObjDeleteDef(obj->conn, pool) < 0)
>          goto cleanup;
> 
> +    char ebuf[1024];
>      if (unlink(pool->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR)
>          storageLog("Failed to delete autostart link '%s': %s",
> -                   pool->autostartLink, strerror(errno));
> +                   pool->autostartLink, virStrerror(errno, ebuf, sizeof ebuf));

The variable decl should be inside the if () {} clause there.

> @@ -788,29 +789,30 @@ static int umlStartVMDaemon(virConnectPtr conn,
>          return -1;
>      }
> 
> +    char ebuf[1024];
>      tmp = progenv;
>      while (*tmp) {

Here, the var decl should be inside the while() loop too

> @@ -99,10 +100,12 @@ virUUIDGenerate(unsigned char *uuid)
>      if (uuid == NULL)
>          return(-1);
> 
> +    char ebuf[1024];
>      if ((err = virUUIDGenerateRandomBytes(uuid, VIR_UUID_BUFLEN)))
>          qemudLog(QEMUD_WARN,
>                   _("Falling back to pseudorandom UUID,"
> -                   " failed to generate random bytes: %s"), strerror(err));
> +                   " failed to generate random bytes: %s"),
> +                 virStrerror(err, ebuf, sizeof ebuf));
> 
>      return virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN);

AGain the ebuf needs to move inside the block

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list