From: John Ferlan Date: Mon, 9 Apr 2018 20:30:10 +0000 (-0400) Subject: Check return status for virUUIDGenerate X-Git-Tag: v4.3.0-rc1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da613819e927e9529c5a7419656d7cb69869d345;p=thirdparty%2Flibvirt.git Check return status for virUUIDGenerate 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 --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9f7dce1bed..b0257068da 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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; 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 a25eaf570e..72ef63a355 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -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; 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;