From 164e6251b33650d3f786d9f4ef38754505408f20 Mon Sep 17 00:00:00 2001 From: John Kacur Date: Thu, 27 Feb 2020 21:52:52 -0500 Subject: [PATCH] rt-tests: cyclictest: Fix parsing affinity with a space and a leading zero -/cyclictest -t -a1-4 ./cyclictest -t -a 1-4 ./cyclictest -t -a0-4 all work as expected, but ./cyclictest -t -a 0-4 did not work, and instead AFFINITY_USEALL was set. This is because atoi(argv[optind]) returns 0 for parsing non-numbers, and this was treated as an error. This missed the case where the user intentionally passes a 0 which should not be treated as an error. Fix this by testing for this case. Signed-off-by: John Kacur --- src/cyclictest/cyclictest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index bd1fcd1..1d2962f 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -1199,7 +1199,7 @@ static void process_options (int argc, char *argv[], int max_cpus) if (optarg != NULL) { parse_cpumask(optarg, max_cpus); setaffinity = AFFINITY_SPECIFIED; - } else if (optind