Whamcloud - gitweb
Fix dump_usued segault in debugfs if used without open filesystem
authorMatthias Koenig <mkoenig@suse.de>
Sun, 28 Jan 2007 17:40:28 +0000 (12:40 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 28 Jan 2007 17:40:28 +0000 (12:40 -0500)
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 <mkoenig@suse.de>
debugfs/ChangeLog
debugfs/unused.c

index a67cd98..4511cc9 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-28  Theodore Tso  <tytso@mit.edu>
+
+       * unused.c: Fix bug so that the dump_unused command segfault if
+               used without an open filesystem
+
 2006-12-22  Theodore Tso  <tytso@mit.edu>
 
        * debugfs.c (main): Use the new {add,remove}_error_table comerr
index f9e10ca..0eee8e6 100644 (file)
@@ -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))