]> git.proxmox.com Git - mirror_lxc.git/commitdiff
lvm: fix thinpool logical volumes
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 23 Sep 2017 20:32:25 +0000 (22:32 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Sun, 24 Sep 2017 22:27:40 +0000 (18:27 -0400)
Closes #1827.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/storage/lvm.c

index 6ceab1dea934bdfaee397dfb1bbebda8d941f58c..105377890f2499b78facc6997baf378829280bf1 100644 (file)
@@ -264,17 +264,18 @@ int lvm_umount(struct lxc_storage *bdev)
 int lvm_compare_lv_attr(const char *path, int pos, const char expected)
 {
        struct lxc_popen_FILE *f;
-       int ret, len, status;
+       int ret, status;
+       size_t len;
        char *cmd;
        char output[12];
-       int start=0;
+       int start = 0;
        const char *lvscmd = "lvs --unbuffered --noheadings -o lv_attr %s 2>/dev/null";
 
-       len = strlen(lvscmd) + strlen(path) - 1;
+       len = strlen(lvscmd) + strlen(path) + 1;
        cmd = alloca(len);
 
        ret = snprintf(cmd, len, lvscmd, path);
-       if (ret < 0 || ret >= len)
+       if (ret < 0 || (size_t)ret >= len)
                return -1;
 
        f = lxc_popen(cmd);
@@ -283,6 +284,7 @@ int lvm_compare_lv_attr(const char *path, int pos, const char expected)
                return -1;
        }
 
+       ret = 0;
        if (!fgets(output, 12, f->f))
                ret = 1;