From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Clark Williams <williams@redhat.com>
Cc: linux-rt-users@vger.kernel.org
Subject: [PATCH] cyclictest: exit with an error code in error case
Date: Mon, 13 Jul 2009 14:32:09 +0200 [thread overview]
Message-ID: <20090713123209.GA2515@www.tglx.de> (raw)
if cyclictest is started with invalid arguments or $SOMETHING, then it
prints the help screen and the exit code is 0 which is wrong.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
src/cyclictest/cyclictest.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index bfb8aa9..e1c9e0e 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -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)
--
1.6.2.5
next reply other threads:[~2009-07-13 12:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-13 12:32 Sebastian Andrzej Siewior [this message]
2009-07-13 17:37 ` [PATCH] cyclictest: exit with an error code in error case Clark Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090713123209.GA2515@www.tglx.de \
--to=bigeasy@linutronix.de \
--cc=linux-rt-users@vger.kernel.org \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox