mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-09 09:35:39 +00:00
bdev.c: don't free right before exit
Also log execlp error code if it returns. Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
72e99249b0
commit
47b6e6cff0
@ -893,18 +893,15 @@ static int do_lvm_create(const char *path, unsigned long size, const char *thinp
|
|||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
lv = strrchr(pathdup, '/');
|
lv = strrchr(pathdup, '/');
|
||||||
if (!lv) {
|
if (!lv)
|
||||||
free(pathdup);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
|
||||||
*lv = '\0';
|
*lv = '\0';
|
||||||
lv++;
|
lv++;
|
||||||
|
|
||||||
vg = strrchr(pathdup, '/');
|
vg = strrchr(pathdup, '/');
|
||||||
if (!vg) {
|
if (!vg)
|
||||||
free(pathdup);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
|
||||||
vg++;
|
vg++;
|
||||||
|
|
||||||
if (thinpool) {
|
if (thinpool) {
|
||||||
@ -912,29 +909,24 @@ static int do_lvm_create(const char *path, unsigned long size, const char *thinp
|
|||||||
tp = alloca(len);
|
tp = alloca(len);
|
||||||
|
|
||||||
ret = snprintf(tp, len, "%s/%s", pathdup, thinpool);
|
ret = snprintf(tp, len, "%s/%s", pathdup, thinpool);
|
||||||
if (ret < 0 || ret >= len) {
|
if (ret < 0 || ret >= len)
|
||||||
free(pathdup);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
|
||||||
|
|
||||||
ret = lvm_is_thin_pool(tp);
|
ret = lvm_is_thin_pool(tp);
|
||||||
INFO("got %d for thin pool at path: %s", ret, tp);
|
INFO("got %d for thin pool at path: %s", ret, tp);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
free(pathdup);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
tp = NULL;
|
tp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tp) {
|
if (!tp)
|
||||||
execlp("lvcreate", "lvcreate", "-L", sz, vg, "-n", lv, (char *)NULL);
|
execlp("lvcreate", "lvcreate", "-L", sz, vg, "-n", lv, (char *)NULL);
|
||||||
} else {
|
else
|
||||||
execlp("lvcreate", "lvcreate", "--thinpool", tp, "-V", sz, vg, "-n", lv, (char *)NULL);
|
execlp("lvcreate", "lvcreate", "--thinpool", tp, "-V", sz, vg, "-n", lv, (char *)NULL);
|
||||||
}
|
|
||||||
|
|
||||||
free(pathdup);
|
SYSERROR("execlp");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user