+2006-11-14 Theodore Tso <tytso@mit.edu>
+
+ * unix.c (PRS): Always allocate the replacement PATH environment
+ passed to putenv() to avoid gcc -Wall warning.
+
+ * pass1.c, pass2.c, profile.c, super.c: Remove unused variables
+ and fixed signed vs unsigned and const gcc -Wall warning.
+
+ * message.c (expand_inode_expression): Fix const gcc -Wall warning.
+
+ * journal.c (e2fsck_fix_ext3_journal_hint): Remove unusued
+ variables retval and problem.
+
2006-11-11 Theodore Tso <tytso@mit.edu>
* super.c (e2fsck_fix_dirhash_hint, check_super_block): If neither
struct problem_context pctx;
char uuid[37], *journal_name;
struct stat st;
- problem_t problem;
- int retval;
if (!(sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) ||
uuid_is_null(sb->s_journal_uuid))
{
struct ext2_inode *inode;
struct ext2_inode_large *large_inode;
- char * time_str;
+ const char * time_str;
time_t t;
int do_gmt = -1;
struct ext2_super_block *sb = ctx->fs->super;
struct ext2_inode_large *inode;
struct ext2_ext_attr_entry *entry;
- char *start, *end, *name;
- int storage_size, remain, offs;
+ char *start, *end;
+ unsigned int storage_size, remain, offs;
int problem = 0;
inode = (struct ext2_inode_large *) pctx->inode;
/* simple remove all possible EA(s) */
*((__u32 *)start) = 0UL;
- e2fsck_write_inode_full(ctx, pctx->ino, inode,
+ e2fsck_write_inode_full(ctx, pctx->ino, (struct ext2_inode *) inode,
EXT2_INODE_SIZE(sb), "pass1");
}
if (ctx->flags & E2F_FLAG_RESIZE_INODE) {
ext2fs_block_bitmap save_bmap;
- errcode_t retval;
save_bmap = fs->block_map;
fs->block_map = ctx->block_found_map;
{
char *cp = (char *) dirent;
int left = fs->blocksize - *offset - dirent->rec_len;
- int name_len = dirent->name_len & 0xFF;
+ unsigned int name_len = dirent->name_len & 0xFF;
/*
* Special case of directory entry of size 8: copy what's left
* record length.
*/
if ((left < 0) &&
- (name_len + 8 <= dirent->rec_len + left) &&
+ (name_len + 8 <= dirent->rec_len + (unsigned) left) &&
dirent->inode <= fs->super->s_inodes_count &&
strnlen(dirent->name, name_len) == name_len) {
dirent->rec_len += left;
char *name;
char *value;
int group_level;
- int final:1; /* Indicate don't search next file */
- int deleted:1;
+ unsigned int final:1; /* Indicate don't search next file */
+ unsigned int deleted:1;
struct profile_node *first_child;
struct profile_node *parent;
struct profile_node *next, *prev;
static int compstr(const void *m1, const void *m2)
{
- const char *s1 = *((const char **) m1);
- const char *s2 = *((const char **) m2);
+ const char *s1 = *((const char * const *) m1);
+ const char *s2 = *((const char * const *) m2);
return strcmp(s1, s2);
}
* resize inode should be cleared) as well as the case where on-line
* resizing is enabled.
*/
-void check_resize_inode(e2fsck_t ctx)
+static void check_resize_inode(e2fsck_t ctx)
{
ext2_filsys fs = ctx->fs;
struct ext2_inode inode;
struct problem_context pctx;
- int i, j, gdt_off, ind_off;
+ int i, gdt_off, ind_off;
+ dgrp_t j;
blk_t blk, pblk, expect;
__u32 *dind_buf = 0, *ind_buf;
errcode_t retval;
/*
* This function checks the dirhash signed/unsigned hint if necessary.
*/
-void e2fsck_fix_dirhash_hint(e2fsck_t ctx)
+static void e2fsck_fix_dirhash_hint(e2fsck_t ctx)
{
struct ext2_super_block *sb = ctx->fs->super;
struct problem_context pctx;
- problem_t problem;
- int retval;
char c;
if ((ctx->options & E2F_OPT_READONLY) ||
* Check to see if the superblock last mount time or last
* write time is in the future.
*/
- if (fs->super->s_mtime > ctx->now) {
+ if (fs->super->s_mtime > (__u32) ctx->now) {
pctx.num = fs->super->s_mtime;
if (fix_problem(ctx, PR_0_FUTURE_SB_LAST_MOUNT, &pctx)) {
fs->super->s_mtime = ctx->now;
ext2fs_mark_super_dirty(fs);
}
}
- if (fs->super->s_wtime > ctx->now) {
+ if (fs->super->s_wtime > (__u32) ctx->now) {
pctx.num = fs->super->s_wtime;
if (fix_problem(ctx, PR_0_FUTURE_SB_LAST_WRITE, &pctx)) {
fs->super->s_wtime = ctx->now;
/* Update our PATH to include /sbin if we need to run badblocks */
if (cflag) {
char *oldpath = getenv("PATH");
+ char *newpath;
+ int len = sizeof(PATH_SET) + 1;
+
+ if (oldpath)
+ len += strlen(oldpath);
+
+ newpath = malloc(len);
+ if (!newpath)
+ fatal_error(ctx, "Couldn't malloc() newpath");
+ strcpy(newpath, PATH_SET);
+
if (oldpath) {
- char *newpath;
-
- newpath = (char *) malloc(sizeof (PATH_SET) + 1 +
- strlen (oldpath));
- if (!newpath)
- fatal_error(ctx, "Couldn't malloc() newpath");
- strcpy (newpath, PATH_SET);
- strcat (newpath, ":");
- strcat (newpath, oldpath);
- putenv (newpath);
- } else
- putenv (PATH_SET);
+ strcat(newpath, ":");
+ strcat(newpath, oldpath);
+ }
+ putenv(newpath);
}
#ifdef CONFIG_JBD_DEBUG
if (getenv("E2FSCK_JBD_DEBUG"))
+2006-11-14 Theodore Tso <tytso@mit.edu>
+
+ * mke2fs.c (PRS): Always allocate the replacement PATH environment
+ passed to putenv() to avoid gcc -Wall warning. Fix signed
+ vs unsigned warning.
+
+ * filefrag.c: Fix signed vs. unsigned gcc -Wall warning
+
+ * chattr.c (usage, fatal_error): Rework functions to avoid gcc
+ -Wall complaints.
+
2006-11-12 Theodore Tso <tytso@mit.edu>
* dumpe2fs.c (main): Open filesystems with the SOFTSUPP flag, to
#define STRUCT_STAT struct stat
#endif
-static void fatal_error(const char * fmt_string, int errcode)
+static void usage(void)
{
- fprintf (stderr, fmt_string, program_name);
- exit (errcode);
+ fprintf(stderr,
+ _("Usage: %s [-RV] [-+=AacDdijsSu] [-v version] files...\n"),
+ program_name);
+ exit(1);
}
-#define usage() fatal_error(_("Usage: %s [-RV] [-+=AacDdijsSu] [-v version] files...\n"), \
- 1)
-
struct flags_char {
unsigned long flag;
char optchar;
char *path;
path = malloc(strlen (dir_name) + 1 + strlen (de->d_name) + 1);
- if (!path)
- fatal_error(_("Couldn't allocate path variable "
- "in chattr_dir_proc"), 1);
+ if (!path) {
+ fprintf(stderr, _("Couldn't allocate path variable "
+ "in chattr_dir_proc"));
+ exit(1);
+ }
sprintf (path, "%s/%s", dir_name, de->d_name);
change_attributes (path);
free(path);
struct stat fileinfo;
#endif
int bs;
- long i, fd;
- unsigned long block, last_block = 0, numblocks;
+ long fd;
+ unsigned long block, last_block = 0, numblocks, i;
long bpib; /* Blocks per indirect block */
long cylgroups;
int discont = 0, expected;
int s_opt = -1, r_opt = -1;
char *fs_features = 0;
int use_bsize;
+ char *newpath;
+ int pathlen = sizeof(PATH_SET) + 1;
+
+ if (oldpath)
+ pathlen += strlen(oldpath);
+ newpath = malloc(pathlen);
+ strcpy(newpath, PATH_SET);
/* Update our PATH to include /sbin */
if (oldpath) {
- char *newpath;
-
- newpath = malloc(sizeof (PATH_SET) + 1 + strlen (oldpath));
- strcpy (newpath, PATH_SET);
strcat (newpath, ":");
strcat (newpath, oldpath);
- putenv (newpath);
- } else
- putenv (PATH_SET);
+ }
+ putenv (newpath);
tmp = getenv("MKE2FS_SYNC");
if (tmp)
}
}
- if (!force && fs_param.s_blocks_count >= (1 << 31)) {
+ if (!force && fs_param.s_blocks_count >= ((unsigned) 1 << 31)) {
com_err(program_name, 0,
_("Filesystem too large. No more than 2**31-1 blocks\n"
"\t (8TB using a blocksize of 4k) are currently supported."));