]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
badblocks: separate and improve error messages for blocks_at_once
authorCorey Hickey <bugfood-c@fatooh.org>
Mon, 24 Jan 2022 02:33:22 +0000 (18:33 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 1 Feb 2023 16:37:32 +0000 (11:37 -0500)
commit8c48a46ebd63d213ab8fb55564f7a1ba5782efbe
treec55ab143a041e3f99684335eac2725bf2035b596
parent513e559bfccc1a909900a47841a4367bdfff1470
badblocks: separate and improve error messages for blocks_at_once

Since the conditional checks the product of block_size and
blocks_at_once, reporting that the problem is solely with
blocks_at_once is misleading.

Also change the error to use the name of the parameter listed in the
manual rather than the variable name.

Since blocks_at_once is unsigned, change the test to == rather than <=.

Before:
$ misc/badblocks -w -b 16777216 -c 524288 -e 1 -s -v /tmp/testfile.bin
misc/badblocks: Invalid blocks_at_once: 524288

After:
$ misc/badblocks -w -b 16777216 -c 524288 -e 1 -s -v /tmp/testfile.bin
misc/badblocks: For block size 16777216, blocks_at_once too large: 524288

$ misc/badblocks -w -b 16777216 -c 0 -e 1 -s -v /tmp/testfile.bin
misc/badblocks: Invalid number of blocks: 0

Signed-off-by: Corey Hickey <bugfood-c@fatooh.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/badblocks.c