diff options
author | Andreas Dilger <adilger@whamcloud.com> | 2011-09-24 12:59:31 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-09-24 13:00:24 -0400 |
commit | 6b56f3d92d08806ab415e8fd883480f7f9c148e8 (patch) | |
tree | aab94e809cda4d95c1bc81712dd1a8859d65b942 | |
parent | 9d9a53e651fa877eb4f9df0bfd97fbcc5f514293 (diff) | |
download | e2fsprogs-6b56f3d92d08806ab415e8fd883480f7f9c148e8.tar.gz |
misc: quiet minor compiler errors
Several compiler errors are quieted:
- zero-length gnu_printf format string
- unused variable
- uninitalized variable (though it isn't actually used for anything)
- fixed a bug in ext2fs_stat() if stat64() does not exist
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | e2fsck/ea_refcount.c | 30 | ||||
-rw-r--r-- | e2fsck/problem.c | 1 | ||||
-rw-r--r-- | e2fsck/region.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/crc32c.c | 1 | ||||
-rw-r--r-- | lib/ext2fs/ext2fs.h | 18 | ||||
-rw-r--r-- | lib/ext2fs/getsize.c | 10 | ||||
-rw-r--r-- | lib/quota/dqblk_v2.h | 2 | ||||
-rw-r--r-- | misc/tune2fs.c | 2 |
8 files changed, 35 insertions, 31 deletions
diff --git a/e2fsck/ea_refcount.c b/e2fsck/ea_refcount.c index 115bd6f2..35105e45 100644 --- a/e2fsck/ea_refcount.c +++ b/e2fsck/ea_refcount.c @@ -407,8 +407,8 @@ int main(int argc, char **argv) size = bcode_program[i++]; retval = ea_refcount_create(size, &refcount); if (retval) { - com_err("ea_refcount_create", - retval, ""); + com_err("ea_refcount_create", retval, + "while creating size %d", size); exit(1); } else printf("Creating refcount with size %d\n", @@ -422,35 +422,35 @@ int main(int argc, char **argv) case BCODE_STORE: blk = (blk_t) bcode_program[i++]; arg = bcode_program[i++]; - retval = ea_refcount_store(refcount, blk, arg); printf("Storing blk %u with value %d\n", blk, arg); + retval = ea_refcount_store(refcount, blk, arg); if (retval) - com_err("ea_refcount_store", retval, ""); + com_err("ea_refcount_store", retval, + "while storing blk %u", blk); break; case BCODE_FETCH: blk = (blk_t) bcode_program[i++]; retval = ea_refcount_fetch(refcount, blk, &arg); if (retval) - com_err("ea_refcount_fetch", retval, ""); + com_err("ea_refcount_fetch", retval, + "while fetching blk %u", blk); else printf("bcode_fetch(%u) returns %d\n", blk, arg); break; case BCODE_INCR: blk = (blk_t) bcode_program[i++]; - retval = ea_refcount_increment(refcount, blk, - &arg); + retval = ea_refcount_increment(refcount, blk, &arg); if (retval) com_err("ea_refcount_increment", retval, - ""); + "while incrementing blk %u", blk); else printf("bcode_increment(%u) returns %d\n", blk, arg); break; case BCODE_DECR: blk = (blk_t) bcode_program[i++]; - retval = ea_refcount_decrement(refcount, blk, - &arg); + retval = ea_refcount_decrement(refcount, blk, &arg); if (retval) com_err("ea_refcount_decrement", retval, "while decrementing blk %u", blk); @@ -461,20 +461,18 @@ int main(int argc, char **argv) case BCODE_VALIDATE: retval = ea_refcount_validate(refcount, stderr); if (retval) - com_err("ea_refcount_validate", - retval, ""); + com_err("ea_refcount_validate", retval, + "while validating"); else printf("Refcount validation OK.\n"); break; case BCODE_LIST: ea_refcount_intr_begin(refcount); while (1) { - blk = ea_refcount_intr_next(refcount, - &arg); + blk = ea_refcount_intr_next(refcount, &arg); if (!blk) break; - printf("\tblk=%u, count=%d\n", blk, - arg); + printf("\tblk=%u, count=%d\n", blk, arg); } break; case BCODE_COLLAPSE: diff --git a/e2fsck/problem.c b/e2fsck/problem.c index 0d56983e..2c494934 100644 --- a/e2fsck/problem.c +++ b/e2fsck/problem.c @@ -1979,6 +1979,7 @@ int main(int argc, char *argv[]) e2fsck_t ctx; int rc; + memset(&ctx, 0, sizeof(ctx)); /* just to quiet compiler */ rc = verify_problem_table(ctx); if (rc == 0) printf("e2fsck problem table verified\n"); diff --git a/e2fsck/region.c b/e2fsck/region.c index 2d593561..e9abb569 100644 --- a/e2fsck/region.c +++ b/e2fsck/region.c @@ -173,7 +173,7 @@ int main(int argc, char **argv) { region_t r; int pc = 0, ret; - region_addr_t start, end, len; + region_addr_t start, end; while (1) { diff --git a/lib/ext2fs/crc32c.c b/lib/ext2fs/crc32c.c index c9b610bf..65bca5c3 100644 --- a/lib/ext2fs/crc32c.c +++ b/lib/ext2fs/crc32c.c @@ -30,7 +30,6 @@ */ #include "config.h" #include <stdint.h> -#include <endian.h> #include <stdlib.h> #include <stdio.h> #define __force diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h index c3237dbf..b91eef8f 100644 --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@ -586,7 +586,7 @@ typedef struct ext2_icount *ext2_icount_t; #define EXT2FS_NUM_B2C(fs, blks) (((blks) + EXT2FS_CLUSTER_MASK(fs)) >> \ (fs)->cluster_ratio_bits) -#ifdef HAVE_OPEN64 +#if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED) typedef struct stat64 ext2fs_struct_stat; #else typedef struct stat ext2fs_struct_stat; @@ -1411,6 +1411,7 @@ extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b); extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b); extern int ext2fs_open_file(const char *pathname, int flags, ...); extern int ext2fs_stat(const char *path, ext2fs_struct_stat *buf); +extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf); /* * The actual inlined functions definitions themselves... @@ -1671,7 +1672,7 @@ _INLINE_ int ext2fs_open_file(const char *pathname, int flags, ...) va_end(args); if (mode) -#ifdef HAVE_OPEN64 +#if defined(HAVE_OPEN64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED) return open64(pathname, flags, mode); else return open64(pathname, flags); @@ -1684,10 +1685,19 @@ _INLINE_ int ext2fs_open_file(const char *pathname, int flags, ...) _INLINE_ int ext2fs_stat(const char *path, ext2fs_struct_stat *buf) { -#ifdef HAVE_OPEN64 +#if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED) return stat64(path, buf); #else - return open(path, buf); + return stat(path, buf); +#endif +} + +_INLINE_ int ext2fs_fstat(int fd, ext2fs_struct_stat *buf) +{ +#if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED) + return fstat64(fd, buf); +#else + return fstat(fd, buf); #endif } diff --git a/lib/ext2fs/getsize.c b/lib/ext2fs/getsize.c index 690349c5..a2e6e472 100644 --- a/lib/ext2fs/getsize.c +++ b/lib/ext2fs/getsize.c @@ -232,13 +232,9 @@ errcode_t ext2fs_get_device_size2(const char *file, int blocksize, #endif /* HAVE_SYS_DISKLABEL_H */ { -#if defined(HAVE_FSTAT64) && !defined(__OSX__) - struct stat64 st; - if (fstat64(fd, &st) == 0) -#else - struct stat st; - if (fstat(fd, &st) == 0) -#endif + ext2fs_struct_stat st; + + if (ext2fs_fstat(fd, &st) == 0) if (S_ISREG(st.st_mode)) { *retblocks = st.st_size / blocksize; goto out; diff --git a/lib/quota/dqblk_v2.h b/lib/quota/dqblk_v2.h index ca07902c..18055c69 100644 --- a/lib/quota/dqblk_v2.h +++ b/lib/quota/dqblk_v2.h @@ -32,7 +32,7 @@ struct v2_mem_dqinfo { }; struct v2_mem_dqblk { - loff_t dqb_off; /* Offset of dquot in file */ + long long dqb_off; /* Offset of dquot in file */ }; struct quotafile_ops; /* Will be defined later in quotaio.h */ diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 11ef0958..3e126971 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -2017,7 +2017,7 @@ retry_open: printf(_("Setting stripe width to %d\n"), stripe_width); } if (ext_mount_opts) { - strncpy(fs->super->s_mount_opts, ext_mount_opts, + strncpy((char *)(fs->super->s_mount_opts), ext_mount_opts, sizeof(fs->super->s_mount_opts)); fs->super->s_mount_opts[sizeof(fs->super->s_mount_opts)-1] = 0; ext2fs_mark_super_dirty(fs); |