[PATCH 05/17] rt-tests: cyclictest: Check user supplies an value to histogram

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



histogram and histofall take a required argument.

If the user fails to supply one, display the help and exit with an error

Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
---
 src/cyclictest/cyclictest.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 2187d98de725..e4d43481de97 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1089,7 +1089,10 @@ static void process_options(int argc, char *argv[], int max_cpus)
 			histofall = 1; /* fall through */
 		case 'h':
 		case OPT_HISTOGRAM:
-			histogram = atoi(optarg); break;
+			histogram = atoi(optarg);
+			if (!histogram)
+				display_help(1);
+			break;
 		case OPT_HISTFILE:
 			use_histfile = 1;
 			strncpy(histfile, optarg, strnlen(optarg, MAX_PATH-1));
-- 
2.31.1




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux