[libvirt] [PATCH 14/13] Adapt to VIR_STRDUP and VIR_STRNDUP in tools/virsh.c
Eric Blake
eblake at redhat.com
Thu May 23 19:30:34 UTC 2013
On 05/23/2013 10:32 AM, Michal Privoznik wrote:
> ---
>
> In case we want virsh included to these changes.
Yes, we do.
>
> tools/virsh.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 6f0c1ef..26d37c6 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -122,9 +122,7 @@ _vshStrdup(vshControl *ctl, const char *s, const char *filename, int line)
> {
> char *x;
>
> - if (s == NULL)
> - return NULL;
> - if ((x = strdup(s)))
> + if (VIR_STRDUP(x, s) >= 0)
ACK. Wow - the 0 return value actually made sense :)
> return x;
> vshError(ctl, _("%s: %d: failed to allocate %lu bytes"),
> filename, line, (unsigned long)strlen(s));
>
--
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/20130523/f7064ac7/attachment-0001.sig>
More information about the libvir-list
mailing list