Whamcloud - gitweb
LU-16067 misc: cleanup compiler warnings
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 2 Aug 2022 23:08:19 +0000 (17:08 -0600)
committerLi Dongyang <dongyangli@ddn.com>
Fri, 28 Apr 2023 01:21:35 +0000 (11:21 +1000)
Remove unused variables and various similar warnings.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I2a773d118960deb42f77c1ae8b038029e6f6cd18
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
e2fsck/pass1.c
e2fsck/pass2.c
e2fsck/util.c
lib/ext2fs/ismounted.c

index 8870fd8..66f0e9c 100644 (file)
@@ -1714,7 +1714,6 @@ static int precreated_object(struct ext2_inode *inode)
 
 void e2fsck_pass1_run(e2fsck_t ctx)
 {
-       int     i;
        ext2_filsys fs = ctx->fs;
        ext2_ino_t      ino = 0;
        struct ext2_inode *inode = NULL;
@@ -1738,7 +1737,7 @@ void e2fsck_pass1_run(e2fsck_t ctx)
        dgrp_t          ra_group = 0;
        struct ea_quota ea_ibody_quota;
        struct process_inode_block *inodes_to_process;
-       int             process_inode_count, check_mmp;
+       int             process_inode_count, check_mmp = 0;
        e2fsck_t        global_ctx = ctx->global_ctx ? ctx->global_ctx : ctx;
        int             inode_exp = 0;
 
@@ -2227,6 +2226,7 @@ void e2fsck_pass1_run(e2fsck_t ctx)
                        void *ehp;
 #ifdef WORDS_BIGENDIAN
                        __u32 tmp_block[EXT2_N_BLOCKS];
+                       int i;
 
                        for (i = 0; i < EXT2_N_BLOCKS; i++)
                                tmp_block[i] = ext2fs_swab32(inode->i_block[i]);
index 1a7aa83..ea5db64 100644 (file)
@@ -2042,7 +2042,6 @@ int e2fsck_process_bad_inode(e2fsck_t ctx, ext2_ino_t dir,
        unsigned char           *frag, *fsize;
        struct problem_context  pctx;
        problem_t               problem = 0;
-       __u16                   badness = 0;
        unsigned int            flags = ctx->fs->flags;
 
        flags = ctx->fs->flags;
index b7c1e7a..8579aac 100644 (file)
@@ -107,7 +107,6 @@ void log_out(e2fsck_t ctx, const char *fmt, ...)
        int buf_size;
        int msg_size;
        int left_size;
-       int fmt_length = strlen(fmt);
 
 #ifdef HAVE_PTHREAD
        if ((ctx->options & E2F_OPT_MULTITHREAD) && ctx->global_ctx) {
index 905f5e1..eda04a3 100644 (file)
@@ -381,7 +381,8 @@ static int check_lustre_zfs(char *mnt_device, const char *real_devname)
                int line = 0;
                while (!feof(fp)) {
                        memset(buf, 0, PATH_MAX);
-                       fscanf(fp, "%s%*[^\n]", buf);
+                       if (fscanf(fp, "%s%*[^\n]", buf) < 1)
+                               break;
                        /* skip the first line */
                        if (line++ == 0)
                                continue;