]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Check return status for virUUIDGenerate
authorJohn Ferlan <jferlan@redhat.com>
Mon, 9 Apr 2018 20:30:10 +0000 (16:30 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 24 Apr 2018 12:52:59 +0000 (08:52 -0400)
Although legal, a few paths were not checking a return value < 0
for failure instead they checked a non zero failure.

Clean them all up to be consistent.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/conf/domain_conf.c
src/conf/network_conf.c
src/conf/secret_conf.c
src/openvz/openvz_conf.c
src/xenconfig/xen_common.c

index 9f7dce1bed0f3591583b057deb643c7df9c0f4c1..b0257068dabba1ffdccbdfd5000a391b8b492905 100644 (file)
@@ -18801,7 +18801,7 @@ virDomainDefParseXML(xmlDocPtr xml,
      * also serve as the uuid. */
     tmp = virXPathString("string(./uuid[1])", ctxt);
     if (!tmp) {
-        if (virUUIDGenerate(def->uuid)) {
+        if (virUUIDGenerate(def->uuid) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            "%s", _("Failed to generate UUID"));
             goto error;
index 54109a3d2ef851bf5ea7e642da7bfc64124672e2..630a87fc07f7c2c269e1f36fd0440183f52ed20a 100644 (file)
@@ -1619,7 +1619,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
     /* Extract network uuid */
     tmp = virXPathString("string(./uuid[1])", ctxt);
     if (!tmp) {
-        if (virUUIDGenerate(def->uuid)) {
+        if (virUUIDGenerate(def->uuid) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            "%s", _("Failed to generate UUID"));
             goto error;
index 989705234c76112118ef8d8daa2baf3e8857a311..7a2e4b28aad2cf415466d8f8a1f9002421d95ebc 100644 (file)
@@ -177,7 +177,7 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
 
     uuidstr = virXPathString("string(./uuid)", ctxt);
     if (!uuidstr) {
-        if (virUUIDGenerate(def->uuid)) {
+        if (virUUIDGenerate(def->uuid) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            "%s", _("Failed to generate UUID"));
             goto cleanup;
index a25eaf570ef89ca99c1974d629733b6ab6d93ac5..72ef63a3555e21b05624a932ac3935c351bf5502 100644 (file)
@@ -1019,7 +1019,7 @@ openvzSetUUID(int vpsid)
 {
     unsigned char uuid[VIR_UUID_BUFLEN];
 
-    if (virUUIDGenerate(uuid)) {
+    if (virUUIDGenerate(uuid) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Failed to generate UUID"));
         return -1;
index bc43185363056ea04cf06fc3929ad986a670f453..7db365f36341bc95b4d08c59a17b66223be4b668 100644 (file)
@@ -202,7 +202,7 @@ xenConfigGetUUID(virConfPtr conf, const char *name, unsigned char *uuid)
     }
 
     if (!(val = virConfGetValue(conf, name))) {
-        if (virUUIDGenerate(uuid)) {
+        if (virUUIDGenerate(uuid) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            "%s", _("Failed to generate UUID"));
             return -1;