From c9275d48974a471e03587474b844e8679dd72b33 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 2 Aug 2022 17:08:19 -0600 Subject: [PATCH] LU-16067 misc: cleanup compiler warnings Remove unused variables and various similar warnings. Signed-off-by: Andreas Dilger Change-Id: I2a773d118960deb42f77c1ae8b038029e6f6cd18 Reviewed-by: Artem Blagodarenko Reviewed-by: Li Dongyang --- e2fsck/pass1.c | 4 ++-- e2fsck/pass2.c | 1 - e2fsck/util.c | 1 - lib/ext2fs/ismounted.c | 3 ++- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 6039eaa..b26005b 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -1760,7 +1760,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; @@ -1784,7 +1783,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; time_t tm; @@ -2286,6 +2285,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]); diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index 52d94c0..c414928 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -2091,7 +2091,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; diff --git a/e2fsck/util.c b/e2fsck/util.c index 4d59702..01a3715 100644 --- a/e2fsck/util.c +++ b/e2fsck/util.c @@ -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) { diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c index 5b99c5f..02d6e6b 100644 --- a/lib/ext2fs/ismounted.c +++ b/lib/ext2fs/ismounted.c @@ -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; -- 1.8.3.1