]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
storage: shut up gcc and remove unused variables.
authortomponline <tomp@tomp.uk>
Mon, 4 Mar 2019 08:33:51 +0000 (08:33 +0000)
committertomponline <tomp@tomp.uk>
Mon, 4 Mar 2019 08:33:51 +0000 (08:33 +0000)
Closes #2885.

Signed-off-by: tomponline <tomp@tomp.uk>
src/lxc/storage/loop.c
src/lxc/storage/lvm.c
src/lxc/storage/nbd.c
src/lxc/storage/storage.c

index d53ac04f676de97a1f7f9f0066760d13d347002e..c685cc49e9bfbdf6d67f3f2c38bf7b2bdb786a1d 100644 (file)
@@ -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;
index 990e61e18575272305c415f3a9299cdae7025d25..0c580bb4ae0124ce140844e7059485c998731ee5 100644 (file)
@@ -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;
index 6c59bacf0bda5731090e99e0bd10b74a26348cbb..ab4f752c9d0122e76176c1ea6b43bc21bafdece9 100644 (file)
@@ -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;
 
index 4cff0a1a4d98805a4eb4e0ce929085687dcf1e35..399c65a65383967ac2e701019689f68c3362b2ee 100644 (file)
@@ -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, ",") {