[PATCH v2 4/4] conf: add error checking of UUID generation

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

 



Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ee651e7742..c69d382d70 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30415,7 +30415,11 @@ virDomainNetDefToNetworkPort(virDomainDefPtr dom,
     if (VIR_ALLOC(port) < 0)
         return NULL;
 
-    virUUIDGenerate(port->uuid);
+    if (virUUIDGenerate(port->uuid) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("Failed to generate UUID"));
+        goto error;
+    }
 
     memcpy(port->owneruuid, dom->uuid, VIR_UUID_BUFLEN);
     if (VIR_STRDUP(port->ownername, dom->name) < 0)
@@ -30576,7 +30580,11 @@ virDomainNetDefActualToNetworkPort(virDomainDefPtr dom,
         return NULL;
 
     /* Bad - we need to preserve original port uuid */
-    virUUIDGenerate(port->uuid);
+    if (virUUIDGenerate(port->uuid) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("Failed to generate UUID"));
+        goto error;
+    }
 
     memcpy(port->owneruuid, dom->uuid, VIR_UUID_BUFLEN);
     if (VIR_STRDUP(port->ownername, dom->name) < 0)
-- 
2.21.0

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