[PATCH 01/10] Check return status for virUUIDGenerate

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

 



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@xxxxxxxxxx>
---
 src/conf/domain_conf.c     | 2 +-
 src/conf/network_conf.c    | 2 +-
 src/conf/secret_conf.c     | 2 +-
 src/openvz/openvz_conf.c   | 2 +-
 src/xenconfig/xen_common.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d23182f18a..f57f956503 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18776,7 +18776,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;
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 54109a3d2e..630a87fc07 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -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;
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index 989705234c..7a2e4b28aa 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -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;
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 23a02d749e..deb2520ced 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -1020,7 +1020,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;
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index bc43185363..7db365f363 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -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;
-- 
2.13.6

--
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]

  Powered by Linux