Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d403b28

Browse files
EricccTaiwancharliechiou
andcommitted
Ensure K value in reverseK is at least 1
Passing 0 or a negative value for K does not cause errors, as the input is an integer. However, this behavior may be confusing for users. To improve clarity, enforce K to be an integer greater than or equal to 1 and return an error if the input is invalid. Co-authored-by: Po-Ying Chiu <charlie910417@gmail.com> Change-Id: Ic68c1acbbd45153da8c3d7682d9251eec9ce597f
1 parent aec0044 commit d403b28

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎qtest.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,8 @@ static bool do_reverseK(int argc, char *argv[])
823823
error_check();
824824

825825
if (argc == 2) {
826-
if (!get_int(argv[1], &k)) {
827-
report(1, "Invalid number of K");
826+
if (!get_int(argv[1], &k)||k<1) {
827+
report(1, "Invalid number of K = '%s' (at least 1)", argv[1]);
828828
return false;
829829
}
830830
} else {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /