misc: fix gcc warnings

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
crypto
Darrick J. Wong 2014-08-24 12:16:23 -04:00 committed by Theodore Ts'o
parent 8a17df7195
commit c4c9bc590c
12 changed files with 10 additions and 40 deletions

View File

@ -498,11 +498,6 @@ static void internal_dump_inode_extra(FILE *out,
ext2_ino_t inode_num EXT2FS_ATTR((unused)), ext2_ino_t inode_num EXT2FS_ATTR((unused)),
struct ext2_inode_large *inode) struct ext2_inode_large *inode)
{ {
struct ext2_ext_attr_entry *entry;
__u32 *magic;
char *start, *end;
unsigned int storage_size;
fprintf(out, "Size of extra inode fields: %u\n", inode->i_extra_isize); fprintf(out, "Size of extra inode fields: %u\n", inode->i_extra_isize);
if (inode->i_extra_isize > EXT2_INODE_SIZE(current_fs->super) - if (inode->i_extra_isize > EXT2_INODE_SIZE(current_fs->super) -
EXT2_GOOD_OLD_INODE_SIZE) { EXT2_GOOD_OLD_INODE_SIZE) {
@ -1595,9 +1590,9 @@ void do_write(int argc, char *argv[])
void do_mknod(int argc, char *argv[]) void do_mknod(int argc, char *argv[])
{ {
unsigned long mode, major, minor; unsigned long major, minor;
errcode_t retval; errcode_t retval;
int filetype, nr; int nr;
struct stat st; struct stat st;
if (check_fs_open(argv[0])) if (check_fs_open(argv[0]))
@ -1608,7 +1603,7 @@ void do_mknod(int argc, char *argv[])
return; return;
} }
mode = minor = major = 0; minor = major = 0;
switch (argv[2][0]) { switch (argv[2][0]) {
case 'p': case 'p':
st.st_mode = S_IFIFO; st.st_mode = S_IFIFO;

View File

@ -288,9 +288,6 @@ void do_rm_xattr(int argc, char **argv)
goto out; goto out;
for (i = 2; i < argc; i++) { for (i = 2; i < argc; i++) {
size_t buflen;
char *buf;
err = ext2fs_xattr_remove(h, argv[i]); err = ext2fs_xattr_remove(h, argv[i]);
if (err) if (err)
goto out; goto out;

View File

@ -174,7 +174,6 @@ void do_block_dump(int argc, char *argv[])
errcode_t errcode; errcode_t errcode;
blk64_t block; blk64_t block;
char *file = NULL; char *file = NULL;
unsigned int i, j;
int c, err; int c, err;
if (check_fs_open(argv[0])) if (check_fs_open(argv[0]))

View File

@ -2383,7 +2383,6 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,
if (try_repairs && problem) { if (try_repairs && problem) {
report_problem: report_problem:
if (fix_problem(ctx, problem, pctx)) { if (fix_problem(ctx, problem, pctx)) {
fix_problem_now:
if (ctx->invalid_bitmaps) { if (ctx->invalid_bitmaps) {
/* /*
* If fsck knows the bitmaps are bad, * If fsck knows the bitmaps are bad,

View File

@ -746,7 +746,6 @@ static errcode_t insert_dirent_tail(ext2_filsys fs, void *dirbuf)
struct ext2_dir_entry *d; struct ext2_dir_entry *d;
void *top; void *top;
struct ext2_dir_entry_tail *t; struct ext2_dir_entry_tail *t;
unsigned int rec_len;
d = dirbuf; d = dirbuf;
top = EXT2_DIRENT_TAIL(dirbuf, fs->blocksize); top = EXT2_DIRENT_TAIL(dirbuf, fs->blocksize);

View File

@ -831,7 +831,7 @@ errcode_t e2fsck_expand_directory(e2fsck_t ctx, ext2_ino_t dir,
errcode_t retval; errcode_t retval;
struct expand_dir_struct es; struct expand_dir_struct es;
struct ext2_inode inode; struct ext2_inode inode;
blk64_t sz, before, after; blk64_t sz;
if (!(fs->flags & EXT2_FLAG_RW)) if (!(fs->flags & EXT2_FLAG_RW))
return EXT2_ET_RO_FILSYS; return EXT2_ET_RO_FILSYS;

View File

@ -327,11 +327,7 @@ static void check_block_bitmaps(e2fsck_t ctx)
problem_t problem, save_problem; problem_t problem, save_problem;
int fixit, had_problem; int fixit, had_problem;
errcode_t retval; errcode_t retval;
int old_desc_blocks = 0;
int count = 0;
int cmp_block = 0;
int redo_flag = 0; int redo_flag = 0;
blk64_t super_blk, old_desc_blk, new_desc_blk;
char *actual_buf, *bitmap_buf; char *actual_buf, *bitmap_buf;
actual_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize, actual_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize,

View File

@ -302,8 +302,7 @@ errcode_t ext2fs_free_ext_attr(ext2_filsys fs, ext2_ino_t ino,
{ {
struct ext2_ext_attr_header *header; struct ext2_ext_attr_header *header;
void *block_buf = NULL; void *block_buf = NULL;
dgrp_t grp; blk64_t blk;
blk64_t blk, goal;
errcode_t err; errcode_t err;
struct ext2_inode_large i; struct ext2_inode_large i;
@ -621,7 +620,6 @@ static errcode_t read_xattrs_from_buffer(struct ext2_xattr_handle *handle,
struct ext2_xattr *x; struct ext2_xattr *x;
struct ext2_ext_attr_entry *entry; struct ext2_ext_attr_entry *entry;
const char *prefix; const char *prefix;
void *ptr;
unsigned int remain, prefix_len; unsigned int remain, prefix_len;
errcode_t err; errcode_t err;
unsigned int values_size = storage_size + unsigned int values_size = storage_size +
@ -719,7 +717,6 @@ static void xattrs_free_keys(struct ext2_xattr_handle *h)
errcode_t ext2fs_xattrs_read(struct ext2_xattr_handle *handle) errcode_t ext2fs_xattrs_read(struct ext2_xattr_handle *handle)
{ {
struct ext2_xattr *attrs = NULL, *x;
struct ext2_inode_large *inode; struct ext2_inode_large *inode;
struct ext2_ext_attr_header *header; struct ext2_ext_attr_header *header;
__u32 ea_inode_magic; __u32 ea_inode_magic;
@ -822,7 +819,6 @@ errcode_t ext2fs_xattrs_iterate(struct ext2_xattr_handle *h,
void *data) void *data)
{ {
struct ext2_xattr *x; struct ext2_xattr *x;
errcode_t err;
int ret; int ret;
EXT2_CHECK_MAGIC(h, EXT2_ET_MAGIC_EA_HANDLE); EXT2_CHECK_MAGIC(h, EXT2_ET_MAGIC_EA_HANDLE);
@ -869,11 +865,10 @@ errcode_t ext2fs_xattr_get(struct ext2_xattr_handle *h, const char *key,
errcode_t ext2fs_xattr_inode_max_size(ext2_filsys fs, ext2_ino_t ino, errcode_t ext2fs_xattr_inode_max_size(ext2_filsys fs, ext2_ino_t ino,
size_t *size) size_t *size)
{ {
struct ext2_ext_attr_header *header;
struct ext2_ext_attr_entry *entry; struct ext2_ext_attr_entry *entry;
struct ext2_inode_large *inode; struct ext2_inode_large *inode;
__u32 ea_inode_magic; __u32 ea_inode_magic;
unsigned int storage_size, freesize, minoff; unsigned int minoff;
void *start; void *start;
int i; int i;
errcode_t err; errcode_t err;
@ -903,9 +898,6 @@ errcode_t ext2fs_xattr_inode_max_size(ext2_filsys fs, ext2_ino_t ino,
inode->i_extra_isize, sizeof(__u32)); inode->i_extra_isize, sizeof(__u32));
if (ea_inode_magic == EXT2_EXT_ATTR_MAGIC) { if (ea_inode_magic == EXT2_EXT_ATTR_MAGIC) {
/* has xattrs. calculate the size */ /* has xattrs. calculate the size */
storage_size = EXT2_INODE_SIZE(fs->super) -
EXT2_GOOD_OLD_INODE_SIZE - inode->i_extra_isize -
sizeof(__u32);
start= ((char *) inode) + EXT2_GOOD_OLD_INODE_SIZE + start= ((char *) inode) + EXT2_GOOD_OLD_INODE_SIZE +
inode->i_extra_isize + sizeof(__u32); inode->i_extra_isize + sizeof(__u32);
entry = start; entry = start;
@ -1003,7 +995,6 @@ errcode_t ext2fs_xattr_remove(struct ext2_xattr_handle *handle,
const char *key) const char *key)
{ {
struct ext2_xattr *x; struct ext2_xattr *x;
errcode_t err;
EXT2_CHECK_MAGIC(handle, EXT2_ET_MAGIC_EA_HANDLE); EXT2_CHECK_MAGIC(handle, EXT2_ET_MAGIC_EA_HANDLE);
for (x = handle->attrs; x < handle->attrs + handle->length; x++) { for (x = handle->attrs; x < handle->attrs + handle->length; x++) {

View File

@ -102,9 +102,7 @@ errcode_t ext2fs_new_dir_inline_data(ext2_filsys fs, ext2_ino_t dir_ino,
{ {
struct ext2_dir_entry *dir = NULL; struct ext2_dir_entry *dir = NULL;
errcode_t retval; errcode_t retval;
char *buf;
int rec_len; int rec_len;
int filetype = 0;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);

View File

@ -288,8 +288,6 @@ errcode_t do_symlink_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
char *cp; char *cp;
ext2_ino_t parent_ino; ext2_ino_t parent_ino;
errcode_t retval; errcode_t retval;
struct ext2_inode inode;
struct stat st;
cp = strrchr(name, '/'); cp = strrchr(name, '/');
if (cp) { if (cp) {
@ -324,9 +322,8 @@ errcode_t do_mkdir_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
struct stat *st, ext2_ino_t root) struct stat *st, ext2_ino_t root)
{ {
char *cp; char *cp;
ext2_ino_t parent_ino, ino; ext2_ino_t parent_ino;
errcode_t retval; errcode_t retval;
struct ext2_inode inode;
cp = strrchr(name, '/'); cp = strrchr(name, '/');

View File

@ -52,7 +52,8 @@ int getseed(void)
perror("open"); perror("open");
exit(0); exit(0);
} }
read(fd, &r, sizeof(r)); if (read(fd, &r, sizeof(r)) != sizeof(r))
printf("Unable to read random seed!\n");
close(fd); close(fd);
return r; return r;
} }

View File

@ -186,7 +186,6 @@ static __u32 clear_ok_features[3] = {
static int get_journal_sb(ext2_filsys jfs, char buf[SUPERBLOCK_SIZE]) static int get_journal_sb(ext2_filsys jfs, char buf[SUPERBLOCK_SIZE])
{ {
int retval; int retval;
int start;
journal_superblock_t *jsb; journal_superblock_t *jsb;
if (!(jfs->super->s_feature_incompat & if (!(jfs->super->s_feature_incompat &
@ -805,7 +804,7 @@ static void enable_uninit_bg(ext2_filsys fs)
static errcode_t zero_empty_inodes(ext2_filsys fs) static errcode_t zero_empty_inodes(ext2_filsys fs)
{ {
int length = EXT2_INODE_SIZE(fs->super); int length = EXT2_INODE_SIZE(fs->super);
struct ext2_inode *inode; struct ext2_inode *inode = NULL;
ext2_inode_scan scan; ext2_inode_scan scan;
errcode_t retval; errcode_t retval;
ext2_ino_t ino; ext2_ino_t ino;
@ -845,7 +844,6 @@ static void disable_uninit_bg(ext2_filsys fs, __u32 csum_feature_flag)
dgrp_t i; dgrp_t i;
errcode_t retval; errcode_t retval;
blk64_t b, c, d; blk64_t b, c, d;
int has_super;
/* Load bitmaps to ensure that the uninit ones get written out */ /* Load bitmaps to ensure that the uninit ones get written out */
fs->super->s_feature_ro_compat |= csum_feature_flag; fs->super->s_feature_ro_compat |= csum_feature_flag;