From: Theodore Ts'o Date: Thu, 28 Nov 2024 03:34:57 +0000 (-0500) Subject: badblocks: avoid an error when -n or -w is specified twice X-Git-Tag: v1.47.2-rc1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c94c00eb67df9d29aee6f9fa599586d01bd84192;p=thirdparty%2Fe2fsprogs.git badblocks: avoid an error when -n or -w is specified twice Fix a bug where if the user specifies the -n or -w command-line option twice, badblocks will issue a misleading (and incorrect) error message. Addresses-Debian-Bug: #1087341 Signed-off-by: Theodore Ts'o --- diff --git a/misc/badblocks.c b/misc/badblocks.c index 2b5ff6d8..2fc1b0df 100644 --- a/misc/badblocks.c +++ b/misc/badblocks.c @@ -1119,13 +1119,13 @@ int main (int argc, char ** argv) v_flag++; break; case 'w': - if (w_flag) + if (w_flag && w_flag != 1) exclusive_usage(); test_func = test_rw; w_flag = 1; break; case 'n': - if (w_flag) + if (w_flag && w_flag != 2) exclusive_usage(); test_func = test_nd; w_flag = 2;