Skip to contentSkip to conversation

cyclictest: exit with an error code in error case

PATCH In review Sebastian Andrzej Siewior 2 participants 2 messages Jul 13, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cyclictest: exit with an error code in error case

if cyclictest is started with invalid arguments or $SOMETHING, then it prints the help screen and the exit code is 0 which is wrong.

---
 src/cyclictest/cyclictest.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
src/cyclictest/cyclictest.c +5 -3
index bfb8aa9..e1c9e0e 100644
@@ -746,7 +746,7 @@ out:
 
 
 /* Print usage information */
-static void display_help(void)
+static void display_help(int error)
 {
 	char tracers[MAX_PATH];
 
@@ -805,6 +805,8 @@ static void display_help(void)
                "                           format: --policy=fifo(default) or --policy=rr\n",
 	       tracers
 		);
+	if (error)
+		exit(-1);
 	exit(0);
 }
 
@@ -977,7 +979,7 @@ static void process_options (int argc, char *argv[])
                 case 'w': tracetype = WAKEUP; break;
                 case 'W': tracetype = WAKEUPRT; break;
                 case 'y': handlepolicy(optarg); break;
-		case '?': error = 1; break;
+		case '?': display_help(0); break;
 		}
 	}
 
@@ -1028,7 +1030,7 @@ static void process_options (int argc, char *argv[])
 
 
 	if (error)
-		display_help ();
+		display_help(1);
 }
 
 static int check_kernel(void)
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 8 lines · On Mon, 13 Jul 2009 14:32:09 +0200 Sebastian Andrzej Siewior…

if cyclictest is started with invalid arguments or $SOMETHING, then it prints the help screen and the exit code is 0 which is wrong.

---
 src/cyclictest/cyclictest.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

Thanks, merged and pushed in 0.49