[LTP] [PATCH 2/3] tst_test: Check for -i >= 0

Petr Vorel pvorel@suse.cz
Fri May 20 14:43:13 CEST 2022


Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/tst_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 8e258594a..34cf1333b 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -618,6 +618,8 @@ static void parse_opts(int argc, char *argv[])
 			exit(0);
 		case 'i':
 			iterations = atoi(optarg);
+			if (iterations < 0)
+				tst_brk(TBROK, "Number of iterations (-i) must be >= 0");
 		break;
 		case 'I':
 			duration = atof(optarg);
-- 
2.36.1



More information about the ltp mailing list