From: Theodore Ts'o Date: Wed, 4 Oct 2006 03:35:57 +0000 (-0400) Subject: Fix interpretation of the last_block command-line parameter to badblocks X-Git-Tag: E2FSPROGS-1_40-WIP-1114~32 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=8938ce64dca50d7d0f47f45fdc886de4f0939f0b;p=tools%2Fe2fsprogs.git Fix interpretation of the last_block command-line parameter to badblocks Also update the display messages so they are accurate. Addresses Debian Bug: #386475 Signed-off-by: "Theodore Ts'o" --- diff --git a/misc/ChangeLog b/misc/ChangeLog index 2e29a34..8d912a2 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,10 @@ +2006-10-03 Theodore Tso + + * badblocks.c: Fix the interpretation of the last_block parameter + on the command line, and adjust the last block count + displays in the progress messages. + (Addresses Debian Bug #386475) + 2006-10-02 Theodore Tso * util.c (figure_journal_size): Increase the smallest default diff --git a/misc/badblocks.c b/misc/badblocks.c index 5c89526..40962fb 100644 --- a/misc/badblocks.c +++ b/misc/badblocks.c @@ -350,7 +350,7 @@ static unsigned int test_ro (int dev, unsigned long last_block, } if (v_flag) { fprintf (stderr, _("Checking blocks %lu to %lu\n"), from_count, - last_block); + last_block - 1); } if (t_flag) { fputs(_("Checking for bad blocks in read-only mode\n"), stderr); @@ -360,7 +360,7 @@ static unsigned int test_ro (int dev, unsigned long last_block, flush_bufs(); try = blocks_at_once; currently_testing = from_count; - num_blocks = last_block; + num_blocks = last_block - 1; if (!t_flag && (s_flag || v_flag)) { fputs(_("Checking for bad blocks (read-only test): "), stderr); if (v_flag <= 1) @@ -457,7 +457,7 @@ static unsigned int test_rw (int dev, unsigned long last_block, for (pat_idx = 0; pat_idx < nr_pattern; pat_idx++) { pattern_fill(buffer, pattern[pat_idx], blocks_at_once * block_size); - num_blocks = last_block; + num_blocks = last_block - 1; currently_testing = from_count; if (s_flag && v_flag <= 1) alarm_intr(SIGALRM); @@ -633,7 +633,7 @@ static unsigned int test_nd (int dev, unsigned long last_block, save_ptr = save_base; test_ptr = test_base; currently_testing = from_count; - num_blocks = last_block; + num_blocks = last_block - 1; if (s_flag && v_flag <= 1) alarm_intr(SIGALRM); @@ -979,7 +979,7 @@ int main (int argc, char ** argv) exit(1); } } else { - last_block = strtoul (argv[optind], &tmp, 0); + last_block = strtoul (argv[optind], &tmp, 0) + 1; if (*tmp) { com_err (program_name, 0, _("invalid blocks count - %s"), argv[optind]);