[libvirt] [PATCH 3/7] Test driver implementation of virStorageVolCreateXMLFrom

Daniel P. Berrange berrange at redhat.com
Mon May 11 12:51:24 UTC 2009


On Mon, May 04, 2009 at 01:42:58PM -0400, Cole Robinson wrote:
> 
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  src/test.c |   95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 95 insertions(+), 0 deletions(-)
> 
> +
> +    if (VIR_ALLOC_N(privvol->target.path,
> +                    strlen(privpool->def->target.path) +
> +                    1 + strlen(privvol->name) + 1) < 0) {
> +        virReportOOMError(pool->conn);
> +        goto cleanup;
> +    }
> +
> +    strcpy(privvol->target.path, privpool->def->target.path);
> +    strcat(privvol->target.path, "/");
> +    strcat(privvol->target.path, privvol->name);
> +    privvol->key = strdup(privvol->target.path);
> +    if (privvol->key == NULL) {
> +        virReportOOMError(pool->conn);
> +        goto cleanup;
> +    }

Be a little shorter to just call virAsprintf() for target.path

ACK aside from that

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