]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lvm: Fix return value if lvm_create_clone fails
authorRikard Falkeborn <rikard.falkeborn@gmail.com>
Sat, 11 May 2019 23:46:27 +0000 (01:46 +0200)
committerRikard Falkeborn <rikard.falkeborn@gmail.com>
Sat, 11 May 2019 23:55:34 +0000 (01:55 +0200)
Returning -1 in a function with return type bool is the same as
returning true. Change to return false to indicate error properly.

Detected with cppcheck.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
src/lxc/storage/lvm.c

index e30f821609ad1615c7f80899b352921f20df16e5..cc267b95281e3faf46d1bb1d49373072bfa50df5 100644 (file)
@@ -535,13 +535,13 @@ bool lvm_create_clone(struct lxc_conf *conf, struct lxc_storage *orig,
                if (!newsize && blk_getsize(orig, &size) < 0) {
                        ERROR("Failed to detect size of logical volume \"%s\"",
                              orig->src);
-                       return -1;
+                       return false;
                }
 
                /* detect filesystem */
                if (detect_fs(orig, fstype, 100) < 0) {
                        INFO("Failed to detect filesystem type for \"%s\"", orig->src);
-                       return -1;
+                       return false;
                }
        } else if (!newsize) {
                        size = DEFAULT_FS_SIZE;
@@ -553,7 +553,7 @@ bool lvm_create_clone(struct lxc_conf *conf, struct lxc_storage *orig,
        ret = do_lvm_create(src, size, thinpool);
        if (ret < 0) {
                ERROR("Failed to create lvm storage volume \"%s\"", src);
-               return -1;
+               return false;
        }
 
        cmd_args[0] = fstype;
@@ -563,7 +563,7 @@ bool lvm_create_clone(struct lxc_conf *conf, struct lxc_storage *orig,
        if (ret < 0) {
                ERROR("Failed to create new filesystem \"%s\" for lvm storage "
                      "volume \"%s\": %s", fstype, src, cmd_output);
-               return -1;
+               return false;
        }
 
        data.orig = orig;