From: Matthias Koenig Date: Sun, 28 Jan 2007 17:40:28 +0000 (-0500) Subject: Fix dump_usued segault in debugfs if used without open filesystem X-Git-Tag: E2FSPROGS-1_40~119 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=97fa31b947b3b55f876c26090eaed982f77f522f;p=tools%2Fe2fsprogs.git Fix dump_usued segault in debugfs if used without open filesystem The dump_unused command in debugfs segfaults if used without an open filesystem: sor:~ # debugfs debugfs 1.39 (29-May-2006) debugfs: dump_unused Segmentation fault Patch (from IBM) below. Signed-off-by: Matthias Koenig --- diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog index a67cd98..4511cc9 100644 --- a/debugfs/ChangeLog +++ b/debugfs/ChangeLog @@ -1,3 +1,8 @@ +2007-01-28 Theodore Tso + + * unused.c: Fix bug so that the dump_unused command segfault if + used without an open filesystem + 2006-12-22 Theodore Tso * debugfs.c (main): Use the new {add,remove}_error_table comerr diff --git a/debugfs/unused.c b/debugfs/unused.c index f9e10ca..0eee8e6 100644 --- a/debugfs/unused.c +++ b/debugfs/unused.c @@ -31,6 +31,10 @@ void do_dump_unused(int argc EXT2FS_ATTR((unused)), char **argv) unsigned int i; errcode_t retval; + if (common_args_process(argc, argv, 1, 1, + "dump_unused", "", 0)) + return; + for (blk=current_fs->super->s_first_data_block; blk < current_fs->super->s_blocks_count; blk++) { if (ext2fs_test_block_bitmap(current_fs->block_map,blk))