Commit 17a643b7 by Stéphane Graber Committed by GitHub

Merge pull request #1828 from brauner/2017-09-23/storage_driver_lvm_fix_thinpool

lvm: fix thinpool logical volumes
parents dfc8e7fe 4280c0e4
...@@ -264,17 +264,18 @@ int lvm_umount(struct lxc_storage *bdev) ...@@ -264,17 +264,18 @@ int lvm_umount(struct lxc_storage *bdev)
int lvm_compare_lv_attr(const char *path, int pos, const char expected) int lvm_compare_lv_attr(const char *path, int pos, const char expected)
{ {
struct lxc_popen_FILE *f; struct lxc_popen_FILE *f;
int ret, len, status; int ret, status;
size_t len;
char *cmd; char *cmd;
char output[12]; char output[12];
int start=0; int start = 0;
const char *lvscmd = "lvs --unbuffered --noheadings -o lv_attr %s 2>/dev/null"; 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); cmd = alloca(len);
ret = snprintf(cmd, len, lvscmd, path); ret = snprintf(cmd, len, lvscmd, path);
if (ret < 0 || ret >= len) if (ret < 0 || (size_t)ret >= len)
return -1; return -1;
f = lxc_popen(cmd); f = lxc_popen(cmd);
...@@ -283,6 +284,7 @@ int lvm_compare_lv_attr(const char *path, int pos, const char expected) ...@@ -283,6 +284,7 @@ int lvm_compare_lv_attr(const char *path, int pos, const char expected)
return -1; return -1;
} }
ret = 0;
if (!fgets(output, 12, f->f)) if (!fgets(output, 12, f->f))
ret = 1; ret = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment