Skip to content

Commit 7f718cf

Browse files
committed
Ensure repetitions input is at least 1
Passing 0 or a negative value for repetitions does not cause errors, as the input is an integer. However, this behavior may be confusing for users. To improve clarity, enforce repetitions to be an integer greater than or equal to 1 and return an error if the input is invalid. Change-Id: Ifbe1e1846f6eac2c933a00a3a9af5d4c533f3c5f
1 parent 3c7c7b3 commit 7f718cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

qtest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static bool queue_insert(position_t pos, int argc, char *argv[])
210210

211211
char *inserts = argv[1];
212212
if (argc == 3) {
213-
if (!get_int(argv[2], &reps)) {
213+
if (!get_int(argv[2], &reps) || reps < 1) {
214214
report(1, "Invalid number of insertions '%s'", argv[2]);
215215
return false;
216216
}

0 commit comments

Comments
 (0)