[PATCH] vbox: fix VIR_STRDUP value check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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++;
 
                 VBOX_UTF8_FREE(hddlocation);
                 VBOX_UTF16_FREE(hddlocationUtf16);
@@ -7507,7 +7507,7 @@ static int vboxConnectListNetworks(virConnectPtr conn, char **const names, int n
                     VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8);
 
                     VIR_DEBUG("nnames[%d]: %s", ret, nameUtf8);
-                    if (VIR_STRDUP(names[ret], nameUtf8) == 0)
+                    if (VIR_STRDUP(names[ret], nameUtf8) >= 0)
                         ret++;
 
                     VBOX_UTF8_FREE(nameUtf8);
@@ -7585,7 +7585,7 @@ static int vboxConnectListDefinedNetworks(virConnectPtr conn, char **const names
                     VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8);
 
                     VIR_DEBUG("nnames[%d]: %s", ret, nameUtf8);
-                    if (VIR_STRDUP(names[ret], nameUtf8) == 0)
+                    if (VIR_STRDUP(names[ret], nameUtf8) >= 0)
                         ret++;
 
                     VBOX_UTF8_FREE(nameUtf8);
@@ -8087,7 +8087,7 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network,
         networkInterface->vtbl->GetInterfaceType(networkInterface, &interfaceType);
 
         if (interfaceType == HostNetworkInterfaceType_HostOnly) {
-            if (VIR_STRDUP(def->name, network->name) == 0) {
+            if (VIR_STRDUP(def->name, network->name) >= 0) {
                 PRUnichar *networkNameUtf16 = NULL;
                 IDHCPServer *dhcpServer     = NULL;
                 vboxIID vboxnet0IID = VBOX_IID_INITIALIZER;
-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]