From c8c071a07319939dfd7ae2ff1dedec644d750deb Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 11 Jan 2001 16:08:23 +0000 Subject: ChangeLog, e2image.c, mke2fs.c, mklost+found.c, tune2fs.c, util.c, uuidgen.c: e2image.c, mke2fs.c, mklost+found.c, tune2fs.c, util.c, uuidgen.c: Fix gcc -Wall complaints, including one bug in tune2fs caused by a block automatic shadowing version of the variable we really wanted to use, which broke the logic testing to see if the filesystem was mounted. ChangeLog, MCONFIG.in: (gcc-wall-new): Added new target which forgoes the make clean so we only check the newly modified .c files. --- misc/ChangeLog | 6 ++++++ misc/e2image.c | 4 ---- misc/mke2fs.c | 4 ++-- misc/mklost+found.c | 1 + misc/tune2fs.c | 23 +++++++++++------------ misc/util.c | 2 +- misc/uuidgen.c | 3 ++- 7 files changed, 23 insertions(+), 20 deletions(-) (limited to 'misc') diff --git a/misc/ChangeLog b/misc/ChangeLog index e993326c..80472114 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,5 +1,11 @@ 2001-01-11 + * e2image.c, mke2fs.c, mklost+found.c, tune2fs.c, util.c, + uuidgen.c: Fix gcc -Wall complaints, including one bug in + tune2fs caused by a block automatic shadowing version of + the variable we really wanted to use, which broke the + logic testing to see if the filesystem was mounted. + * badblocks.c (flush_bufs): Use ext2fs_sync_device() to sync and flush the device. diff --git a/misc/e2image.c b/misc/e2image.c index 24dcdd7f..f7c42d02 100644 --- a/misc/e2image.c +++ b/misc/e2image.c @@ -49,8 +49,6 @@ static void usage(void) exit (1); } -static const char *please_fsck = N_("Please run e2fsck on the filesystem.\n"); - static void write_header(int fd, struct ext2_image_hdr *hdr) { char header_buf[4096]; @@ -81,13 +79,11 @@ static void write_header(int fd, struct ext2_image_hdr *hdr) int main (int argc, char ** argv) { int c; - char * tmp; errcode_t retval; ext2_filsys fs; int open_flag = 0; int raw_flag = 0; int fd = 0; - char *features_cmd = 0; struct ext2_image_hdr hdr; #ifdef ENABLE_NLS diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 1ba3aaff..b6110659 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -513,9 +513,9 @@ static void show_stats(ext2_filsys fs) 100.0 * s->s_r_blocks_count / s->s_blocks_count); printf(_("First data block=%u\n"), s->s_first_data_block); if (fs->group_desc_count > 1) - printf(_("%lu block groups\n"), fs->group_desc_count); + printf(_("%u block groups\n"), fs->group_desc_count); else - printf(_("%lu block group\n"), fs->group_desc_count); + printf(_("%u block group\n"), fs->group_desc_count); printf(_("%u blocks per group, %u fragments per group\n"), s->s_blocks_per_group, s->s_frags_per_group); printf(_("%u inodes per group\n"), s->s_inodes_per_group); diff --git a/misc/mklost+found.c b/misc/mklost+found.c index a4d0f7d9..37b7a7b1 100644 --- a/misc/mklost+found.c +++ b/misc/mklost+found.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include diff --git a/misc/tune2fs.c b/misc/tune2fs.c index cf2163a6..a28b3e4b 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -55,7 +55,8 @@ extern int optind; const char * program_name = "tune2fs"; char * device_name; -char * new_label, *new_last_mounted, *new_UUID, *journal_opts; +char * new_label, *new_last_mounted, *new_UUID; +const char *journal_opts; static int c_flag, C_flag, e_flag, g_flag, i_flag, l_flag, L_flag; static int m_flag, M_flag, r_flag, s_flag = -1, u_flag, U_flag; static int print_label; @@ -93,7 +94,7 @@ static __u32 ok_features[3] = { /* * Update the feature set as provided by the user. */ -static void update_feature_set(ext2_filsys fs, char *features_cmd) +static void update_feature_set(ext2_filsys fs, char *features) { int sparse, old_sparse, filetype, old_filetype; int journal, old_journal; @@ -107,10 +108,10 @@ static void update_feature_set(ext2_filsys fs, char *features_cmd) EXT2_FEATURE_INCOMPAT_FILETYPE; old_journal = sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL; - if (e2p_edit_feature(features_cmd, &sb->s_feature_compat, + if (e2p_edit_feature(features, &sb->s_feature_compat, ok_features)) { fprintf(stderr, _("Invalid filesystem option set: %s\n"), - features_cmd); + features); exit(1); } sparse = sb->s_feature_ro_compat & @@ -215,9 +216,6 @@ static void add_journal(ext2_filsys fs) } printf(_("done\n")); } else if (journal_size) { - errcode_t retval; - int mount_flags; - printf(_("Creating journal inode: ")); fflush(stdout); retval = ext2fs_add_journal_inode(fs, journal_blocks, @@ -241,7 +239,7 @@ static void add_journal(ext2_filsys fs) /* * Given argv[0], return the program name. */ -char *get_progname(char *argv_zero) +static char *get_progname(char *argv_zero) { char *cp; @@ -253,7 +251,7 @@ char *get_progname(char *argv_zero) } -void parse_e2label_options(int argc, char ** argv) +static void parse_e2label_options(int argc, char ** argv) { if ((argc < 2) || (argc > 3)) { fprintf(stderr, _("Usage: e2label device [newlabel]\n")); @@ -269,7 +267,7 @@ void parse_e2label_options(int argc, char ** argv) } -void parse_tune2fs_options(int argc, char **argv) +static void parse_tune2fs_options(int argc, char **argv) { int c; char * tmp; @@ -487,7 +485,8 @@ int main (int argc, char ** argv) sb = fs->super; if (print_label) { /* For e2label emulation */ - printf("%.*s\n", sizeof(sb->s_volume_name), sb->s_volume_name); + printf("%.*s\n", (int) sizeof(sb->s_volume_name), + sb->s_volume_name); exit(0); } retval = ext2fs_check_if_mounted(device_name, &mount_flags); @@ -495,7 +494,7 @@ int main (int argc, char ** argv) com_err("ext2fs_check_if_mount", retval, _("while determining whether %s is mounted."), device_name); - return; + exit(0); } /* Normally we only need to write out the superblock */ fs->flags |= EXT2_FLAG_SUPER_ONLY; diff --git a/misc/util.c b/misc/util.c index e4e147e6..bf3aabdb 100644 --- a/misc/util.c +++ b/misc/util.c @@ -45,7 +45,7 @@ int strcasecmp (char *s1, char *s2) void proceed_question(void) { char buf[256]; - char *short_yes = _("yY"); + const char *short_yes = _("yY"); fflush(stdout); fflush(stderr); diff --git a/misc/uuidgen.c b/misc/uuidgen.c index b6f38375..6e3fb313 100644 --- a/misc/uuidgen.c +++ b/misc/uuidgen.c @@ -10,6 +10,7 @@ */ #include +#include #ifdef HAVE_GETOPT_H #include #else @@ -22,7 +23,7 @@ extern int optind; #define DO_TYPE_TIME 1 #define DO_TYPE_RANDOM 2 -void usage(const char *progname) +static void usage(const char *progname) { fprintf(stderr, _("Usage: %s [-r] [-t]\n"), progname); exit(1); -- cgit v1.2.3