util: fix wrong comparison inside virStoragePermsCopy()

VIR_STRDUP returns -1 if the string copy was not successful. So, the
current comparison/logic is throwing an error when VIR_STRDUP() returns
1. Only when source is NULL, it is considering as a success which is
not right.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
This commit is contained in:
Julio Faracco 2017-06-01 22:58:06 -03:00 committed by Peter Krempa
parent 8b994d5189
commit 54aee01d87

View File

@ -1974,7 +1974,7 @@ virStoragePermsCopy(const virStoragePerms *src)
ret->uid = src->uid;
ret->gid = src->gid;
if (VIR_STRDUP(ret->label, src->label))
if (VIR_STRDUP(ret->label, src->label) < 0)
goto error;
return ret;