]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: fix wrong comparison inside virStoragePermsCopy()
authorJulio Faracco <jcfaracco@gmail.com>
Fri, 2 Jun 2017 01:58:06 +0000 (22:58 -0300)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 2 Jun 2017 07:37:44 +0000 (09:37 +0200)
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>
src/util/virstoragefile.c

index b43acf67f1a53e8872f0ba7a0f86d58863a2cce4..69648ca967a3dde94bbdcae22d87f35dfcf02ae7 100644 (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;