From: Julio Faracco Date: Fri, 2 Jun 2017 01:58:06 +0000 (-0300) Subject: util: fix wrong comparison inside virStoragePermsCopy() X-Git-Tag: v3.5.0-rc1~190 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54aee01d876ad3d331ead6ea0a574a1326faae32;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index b43acf67f1..69648ca967 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -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;