diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-12-19 04:07:50 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-12-19 04:07:50 +0100 |
commit | 1393fc116109ba96034470a926933e1bcd518470 (patch) | |
tree | aa509570f1581e694e528d2f069fbf5eb2df3f7d | |
parent | 96c8a6b5eade530f28ef73f72f7d188f71bbb1ec (diff) | |
download | busybox-w32-1393fc116109ba96034470a926933e1bcd518470.tar.gz busybox-w32-1393fc116109ba96034470a926933e1bcd518470.tar.bz2 busybox-w32-1393fc116109ba96034470a926933e1bcd518470.zip |
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.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/miscutils/chrt.c b/miscutils/chrt.c index 4477d084c..1c6737a3c 100644 --- a/miscutils/chrt.c +++ b/miscutils/chrt.c | |||
@@ -53,23 +53,25 @@ int chrt_main(int argc UNUSED_PARAM, char **argv) | |||
53 | const char *current_new; | 53 | const char *current_new; |
54 | int policy = SCHED_RR; | 54 | int policy = SCHED_RR; |
55 | 55 | ||
56 | /* at least 1 arg; only one policy accepted */ | 56 | /* only one policy accepted */ |
57 | opt_complementary = "-1:r--fo:f--ro:o--rf"; | 57 | opt_complementary = "r--fo:f--ro:o--rf"; |
58 | opt = getopt32(argv, "+mprfo"); | 58 | opt = getopt32(argv, "+mprfo"); |
59 | if (opt & OPT_m) { /* print min/max and exit */ | ||
60 | show_min_max(SCHED_FIFO); | ||
61 | show_min_max(SCHED_RR); | ||
62 | show_min_max(SCHED_OTHER); | ||
63 | fflush_stdout_and_exit(EXIT_SUCCESS); | ||
64 | } | ||
59 | if (opt & OPT_r) | 65 | if (opt & OPT_r) |
60 | policy = SCHED_RR; | 66 | policy = SCHED_RR; |
61 | if (opt & OPT_f) | 67 | if (opt & OPT_f) |
62 | policy = SCHED_FIFO; | 68 | policy = SCHED_FIFO; |
63 | if (opt & OPT_o) | 69 | if (opt & OPT_o) |
64 | policy = SCHED_OTHER; | 70 | policy = SCHED_OTHER; |
65 | if (opt & OPT_m) { /* print min/max */ | ||
66 | show_min_max(SCHED_FIFO); | ||
67 | show_min_max(SCHED_RR); | ||
68 | show_min_max(SCHED_OTHER); | ||
69 | fflush_stdout_and_exit(EXIT_SUCCESS); | ||
70 | } | ||
71 | 71 | ||
72 | argv += optind; | 72 | argv += optind; |
73 | if (!argv[0]) | ||
74 | bb_show_usage(); | ||
73 | if (opt & OPT_p) { | 75 | if (opt & OPT_p) { |
74 | pid_str = *argv++; | 76 | pid_str = *argv++; |
75 | if (*argv) { /* "-p <priority> <pid> [...]" */ | 77 | if (*argv) { /* "-p <priority> <pid> [...]" */ |