diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-02-27 13:38:56 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-02-27 13:38:56 -0500 |
commit | 5aae7c292fe0e10ec4e36d664da86939d15aca31 (patch) | |
tree | cc157f16562af876aba6676453afc44884b69357 | |
parent | 3a538e42441afa5e5b34942062acb976e0d345f6 (diff) | |
download | e2fsprogs-5aae7c292fe0e10ec4e36d664da86939d15aca31.tar.gz |
debugfs: Fix find_free_block to avoid reporting the block more than once
Addresses-Sourceforge-Bug: #1096315
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | debugfs/debugfs.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 818ce530..a92933d2 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -1155,7 +1155,7 @@ void do_unlink(int argc, char *argv[]) void do_find_free_block(int argc, char *argv[]) { - blk_t free_blk, goal; + blk_t free_blk, goal, first_free = 0; int count; errcode_t retval; char *tmp; @@ -1191,6 +1191,11 @@ void do_find_free_block(int argc, char *argv[]) while (count-- > 0) { retval = ext2fs_new_block(current_fs, free_blk + 1, 0, &free_blk); + if (first_free) { + if (first_free == free_blk) + break; + } else + first_free = free_blk; if (retval) { com_err("ext2fs_new_block", retval, 0); return; |