提交 473d2eba 编写于 作者: D Daniel P. Berrangé

conf: add error checking of UUID generation

Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 520f5752
...@@ -30415,7 +30415,11 @@ virDomainNetDefToNetworkPort(virDomainDefPtr dom, ...@@ -30415,7 +30415,11 @@ virDomainNetDefToNetworkPort(virDomainDefPtr dom,
if (VIR_ALLOC(port) < 0) if (VIR_ALLOC(port) < 0)
return NULL; 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); memcpy(port->owneruuid, dom->uuid, VIR_UUID_BUFLEN);
if (VIR_STRDUP(port->ownername, dom->name) < 0) if (VIR_STRDUP(port->ownername, dom->name) < 0)
...@@ -30576,7 +30580,11 @@ virDomainNetDefActualToNetworkPort(virDomainDefPtr dom, ...@@ -30576,7 +30580,11 @@ virDomainNetDefActualToNetworkPort(virDomainDefPtr dom,
return NULL; return NULL;
/* Bad - we need to preserve original port uuid */ /* 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); memcpy(port->owneruuid, dom->uuid, VIR_UUID_BUFLEN);
if (VIR_STRDUP(port->ownername, dom->name) < 0) if (VIR_STRDUP(port->ownername, dom->name) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册