[libvirt] [PATCH 4/5] virStorageBackendFileSystemMount: prefer strdup over virAsprintf

Eric Blake eblake at redhat.com
Wed Apr 14 14:22:28 UTC 2010


On 04/14/2010 02:46 AM, Jim Meyering wrote:
> From: Jim Meyering <meyering at redhat.com>
> 
> * src/storage/storage_backend_fs.c (virStorageBackendFileSystemMount):
> Use virAsprintf only when needed.  In this case, strdup works fine.
> ---
>  src/storage/storage_backend_fs.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
> index 0b81c6c..c96c4f3 100644
> --- a/src/storage/storage_backend_fs.c
> +++ b/src/storage/storage_backend_fs.c
> @@ -376,7 +376,7 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) {
> 
>      if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
>          if (pool->def->source.format == VIR_STORAGE_POOL_NETFS_GLUSTERFS) {
> -            if (virAsprintf(&options, "direct-io-mode=1") == -1) {
> +            if ((options = strdup("direct-io-mode=1")) == NULL) {

ACK - much lighter-weight.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list