[libvirt] [PATCH] vbox: fix VIR_STRDUP value check
Eric Blake
eblake at redhat.com
Mon May 20 15:55:19 UTC 2013
On 05/20/2013 03:59 AM, Ján Tomko wrote:
> In my review of 31532ca I missed the fact that VIR_STRDUP
> now returns 1 on success, and 0 if the source was NULL.
>
> (This still doesn't add proper OOM error handling.)
> ---
> src/vbox/vbox_tmpl.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
> index eb8ac63..163aeff 100644
> --- a/src/vbox/vbox_tmpl.c
> +++ b/src/vbox/vbox_tmpl.c
> @@ -2688,9 +2688,9 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
>
> if (hddType == HardDiskType_Immutable)
> def->disks[hddNum]->readonly = true;
> - if (VIR_STRDUP_QUIET(def->disks[hddNum]->src, hddlocation) == 0 &&
> - VIR_STRDUP_QUIET(def->disks[hddNum]->dst, "hdd") == 0)
> - hddNum++;
> + ignore_value(VIR_STRDUP(def->disks[hddNum]->src, hddlocation));
> + ignore_value(VIR_STRDUP(def->disks[hddNum]->dst, "hdd"));
> + hddNum++;
This changes the situations in which hddNum is set; now hddNum is
incremented even if you hit an OOM error. Is that really what you want?
--
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/20130520/77f93b28/attachment-0001.sig>
More information about the libvir-list
mailing list