diff options
author | Theodore Ts'o <tytso@mit.edu> | 1998-04-27 01:41:13 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 1998-04-27 01:41:13 +0000 |
commit | 76f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07 (patch) | |
tree | 6fe26cebc11c665c56419240799c179706995c9d /lib/ext2fs/badblocks.c | |
parent | 91b2c42bdbb91275026f08306720b2bef6e129f4 (diff) | |
download | e2fsprogs-76f875daa1c9c2cdc72f0c6f0f7be4bbc7f0fc07.tar.gz |
Many files:
ext2fs.h, bitops.h: Add support for the Watcom C compiler to do inline
functions.
ext2fs.h, dosio.c: Use asm/types.h instead of linux/types.h to evade a
potential problem with glibc's header files trying to spike out
linux/types.h.
ext2fs.h (ext2fs_resize_mem): Change the function prototype to include
the old size of the memory, which is needed for some braindamaged
memory allocation systems that don't support realloc().
badblocks.c (ext2fs_badblocks_list_add):
bb_inode.c (clear_bad_block_proc):
dblist.c (ext2fs_add_dir_block):
icount.c (insert_icount_el):
irel_ma.c (ima_put):
rs_bitmap.c (ext2fs_resize_generic_bitmap): Update functions to pass
the old size of the memory to be resized to ext2fs_resize_mem().
ChangeLog, dirinfo.c:
dirinfo.c (e2fsck_add_dir_info): Update function to pass the old size
of the memory to be resized to ext2fs_resize_mem().
ChangeLog, extent.c, resize2fs.c:
resize2fs.c (adjust_superblock):
extent.c (ext2fs_add_extent_entry): Update functions to pass the old
size of the memory to be resized to ext2fs_resize_mem().
Diffstat (limited to 'lib/ext2fs/badblocks.c')
-rw-r--r-- | lib/ext2fs/badblocks.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ext2fs/badblocks.c b/lib/ext2fs/badblocks.c index 9d43444a..3851ccd6 100644 --- a/lib/ext2fs/badblocks.c +++ b/lib/ext2fs/badblocks.c @@ -101,15 +101,19 @@ errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb, blk_t blk) { errcode_t retval; int i, j; + unsigned long old_size; EXT2_CHECK_MAGIC(bb, EXT2_ET_MAGIC_BADBLOCKS_LIST); if (bb->num >= bb->size) { + old_size = bb->size * sizeof(blk_t); bb->size += 10; - retval = ext2fs_resize_mem(bb->size * sizeof(blk_t), + retval = ext2fs_resize_mem(old_size, bb->size * sizeof(blk_t), (void **) &bb->list); - if (retval) + if (retval) { + bb->size -= 10; return retval; + } } j = bb->num; |