-/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 <jkacur@xxxxxxxxxx> --- 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 bd1fcd1092aa..1d2962fda777 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<argc && atoi(argv[optind])) { + } else if (optind<argc && (atoi(argv[optind]) || argv[optind][0] == '0')) { parse_cpumask(argv[optind], max_cpus); setaffinity = AFFINITY_SPECIFIED; } else { -- 2.20.1