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 <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2018-04-09 16:30:10 -04:00
parent 31daccf5a5
commit da613819e9
5 changed files with 5 additions and 5 deletions

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

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

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

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

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