]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix compiler warnings [-Wmaybe-uninitialized]
authorKarel Zak <kzak@redhat.com>
Thu, 17 Dec 2020 10:07:25 +0000 (11:07 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 17 Dec 2020 10:07:25 +0000 (11:07 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_loopdev.c
libmount/src/lock.c

index c5fc80d77f98866aade9152ea196d43f8a2c97b3..6462bfb62915d04590c30ed43d915223b438c211 100644 (file)
@@ -250,7 +250,7 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt)
 
                case 2: /* overlap -- full size and offset match (reuse) */
                {
-                       uint32_t lc_encrypt_type;
+                       uint32_t lc_encrypt_type = 0;
 
                        DBG(LOOP, ul_debugobj(cxt, "re-using existing loop device %s",
                                loopcxt_get_device(&lc)));
index cc5340db189206407a085b18f7b232eb72c10881..fac64b63b7b8c316a47e65fdbecd2fe6088cad96 100644 (file)
@@ -277,7 +277,7 @@ static void mnt_lockalrm_handler(int sig __attribute__((__unused__)))
  */
 static int mnt_wait_mtab_lock(struct libmnt_lock *ml, struct flock *fl, time_t maxtime)
 {
-       struct timeval now;
+       struct timeval now = { 0 };
        struct sigaction sa, osa;
        int ret = 0;
 
@@ -394,8 +394,8 @@ static void unlock_mtab(struct libmnt_lock *ml)
 static int lock_mtab(struct libmnt_lock *ml)
 {
        int i, rc = -1;
-       struct timespec waittime;
-       struct timeval maxtime;
+       struct timespec waittime = { 0 };;
+       struct timeval maxtime = { 0 };
        const char *lockfile, *linkfile;
 
        if (!ml)
@@ -443,7 +443,7 @@ static int lock_mtab(struct libmnt_lock *ml)
 
        /* Repeat until it was us who made the link */
        while (!ml->locked) {
-               struct timeval now;
+               struct timeval now = { 0 };
                struct flock flock;
                int j;