From 63fce0c1178e38c54915cdcfad72451b9f62b863 Mon Sep 17 00:00:00 2001 From: tomponline Date: Mon, 4 Mar 2019 08:33:51 +0000 Subject: [PATCH] storage: shut up gcc and remove unused variables. Closes #2885. Signed-off-by: tomponline --- src/lxc/storage/loop.c | 2 +- src/lxc/storage/lvm.c | 4 ++-- src/lxc/storage/nbd.c | 2 +- src/lxc/storage/storage.c | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lxc/storage/loop.c b/src/lxc/storage/loop.c index d53ac04f6..c685cc49e 100644 --- a/src/lxc/storage/loop.c +++ b/src/lxc/storage/loop.c @@ -137,7 +137,7 @@ int loop_clonepaths(struct lxc_storage *orig, struct lxc_storage *new, int loop_create(struct lxc_storage *bdev, const char *dest, const char *n, struct bdev_specs *specs) { - __do_free char *srcdev; + __do_free char *srcdev = NULL; const char *fstype; uint64_t sz; int ret, len; diff --git a/src/lxc/storage/lvm.c b/src/lxc/storage/lvm.c index 990e61e18..0c580bb4a 100644 --- a/src/lxc/storage/lvm.c +++ b/src/lxc/storage/lvm.c @@ -114,7 +114,7 @@ static int do_lvm_create(const char *path, uint64_t size, const char *thinpool) char *pathdup, *vg, *lv; char cmd_output[PATH_MAX]; char sz[24]; - __do_free char *tp; + __do_free char *tp = NULL; struct lvcreate_args cmd_args = {0}; ret = snprintf(sz, 24, "%" PRIu64 "b", size); @@ -268,7 +268,7 @@ int lvm_umount(struct lxc_storage *bdev) #define __LVSCMD "lvs --unbuffered --noheadings -o lv_attr %s 2>/dev/null" int lvm_compare_lv_attr(const char *path, int pos, const char expected) { - __do_free char *cmd; + __do_free char *cmd = NULL; struct lxc_popen_FILE *f; int ret, status; size_t len; diff --git a/src/lxc/storage/nbd.c b/src/lxc/storage/nbd.c index 6c59bacf0..ab4f752c9 100644 --- a/src/lxc/storage/nbd.c +++ b/src/lxc/storage/nbd.c @@ -62,7 +62,7 @@ static bool wait_for_partition(const char *path); bool attach_nbd(char *src, struct lxc_conf *conf) { - __do_free char *orig; + __do_free char *orig = NULL; char *p, path[50]; int i = 0; diff --git a/src/lxc/storage/storage.c b/src/lxc/storage/storage.c index 4cff0a1a4..399c65a65 100644 --- a/src/lxc/storage/storage.c +++ b/src/lxc/storage/storage.c @@ -568,9 +568,8 @@ struct lxc_storage *storage_create(const char *dest, const char *type, /* -B lvm,dir */ if (strchr(type, ',')) { - __do_free char *dup; + __do_free char *dup = NULL; char *token; - size_t len; dup = must_copy_string(type); lxc_iterate_parts(token, dup, ",") { -- 2.47.2