Skip to content

Commit

Permalink
Merge pull request #1715 from brauner/2017-07-27/fix_gcc7_bug
Browse files Browse the repository at this point in the history
lvm: check whether lxc.bdev.lvm.vg is empty
  • Loading branch information
stgraber committed Jul 28, 2017
2 parents bef81ce + bb30b52 commit 41609c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/lxc/bdev/lxclvm.c
Expand Up @@ -307,6 +307,11 @@ int lvm_clonepaths(struct bdev *orig, struct bdev *new, const char *oldname,
return -1;
}
vg = lxc_global_config_value("lxc.bdev.lvm.vg");
if (!vg) {
ERROR("The \"lxc.bdev.lvm.vg\" key is not set");
return -1;
}

len = strlen("/dev/") + strlen(vg) + strlen(cname) + 4 + 2;
new->src = malloc(len);
if (new->src)
Expand Down
4 changes: 3 additions & 1 deletion src/lxc/cgroups/cgfsng.c
Expand Up @@ -1315,7 +1315,7 @@ static inline bool cgfsng_create(void *hdata)
{
struct cgfsng_handler_data *d = hdata;
char *tmp, *cgname, *offset;
int i, ret;
int i;
int idx = 0;
size_t len;

Expand Down Expand Up @@ -1343,6 +1343,8 @@ static inline bool cgfsng_create(void *hdata)
goto out_free;
}
if (idx) {
int ret;

ret = snprintf(offset, 5, "-%d", idx);
if (ret < 0 || (size_t)ret >= 5) {
FILE *f = fopen("/dev/null", "w");
Expand Down

0 comments on commit 41609c4

Please sign in to comment.