summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-12-19 03:07:50 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2010-12-19 03:07:50 (GMT)
commit1393fc116109ba96034470a926933e1bcd518470 (patch)
treeaa509570f1581e694e528d2f069fbf5eb2df3f7d
parent96c8a6b5eade530f28ef73f72f7d188f71bbb1ec (diff)
downloadbusybox-1393fc116109ba96034470a926933e1bcd518470.tar.gz
busybox-1393fc116109ba96034470a926933e1bcd518470.tar.bz2
chrt: -m can be used without any arguments. Closes bug 2989
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/chrt.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/miscutils/chrt.c b/miscutils/chrt.c
index 4477d08..1c6737a 100644
--- a/miscutils/chrt.c
+++ b/miscutils/chrt.c
@@ -53,23 +53,25 @@ int chrt_main(int argc UNUSED_PARAM, char **argv)
const char *current_new;
int policy = SCHED_RR;
- /* at least 1 arg; only one policy accepted */
- opt_complementary = "-1:r--fo:f--ro:o--rf";
+ /* only one policy accepted */
+ opt_complementary = "r--fo:f--ro:o--rf";
opt = getopt32(argv, "+mprfo");
+ if (opt & OPT_m) { /* print min/max and exit */
+ show_min_max(SCHED_FIFO);
+ show_min_max(SCHED_RR);
+ show_min_max(SCHED_OTHER);
+ fflush_stdout_and_exit(EXIT_SUCCESS);
+ }
if (opt & OPT_r)
policy = SCHED_RR;
if (opt & OPT_f)
policy = SCHED_FIFO;
if (opt & OPT_o)
policy = SCHED_OTHER;
- if (opt & OPT_m) { /* print min/max */
- show_min_max(SCHED_FIFO);
- show_min_max(SCHED_RR);
- show_min_max(SCHED_OTHER);
- fflush_stdout_and_exit(EXIT_SUCCESS);
- }
argv += optind;
+ if (!argv[0])
+ bb_show_usage();
if (opt & OPT_p) {
pid_str = *argv++;
if (*argv) { /* "-p <priority> <pid> [...]" */