diff options
author | Karel Zak | 2012-07-26 09:26:34 +0200 |
---|---|---|
committer | Karel Zak | 2012-07-26 09:26:34 +0200 |
commit | 2dac37dd68ab17c73e4ed1a7cd2d065c1be20e39 (patch) | |
tree | 74c6870c601ea5d0954faf9644341220096d0ddf /sys-utils/prlimit.c | |
parent | mount: use err_exclusive_options() (diff) | |
download | kernel-qcow2-util-linux-2dac37dd68ab17c73e4ed1a7cd2d065c1be20e39.tar.gz kernel-qcow2-util-linux-2dac37dd68ab17c73e4ed1a7cd2d065c1be20e39.tar.xz kernel-qcow2-util-linux-2dac37dd68ab17c73e4ed1a7cd2d065c1be20e39.zip |
prlimit: use err_exclusive_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/prlimit.c')
-rw-r--r-- | sys-utils/prlimit.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c index cd9a96c62..c21542144 100644 --- a/sys-utils/prlimit.c +++ b/sys-utils/prlimit.c @@ -34,7 +34,6 @@ #include "strutils.h" #include "list.h" #include "closestream.h" -#include "optutils.h" #ifndef RLIMIT_RTTIME # define RLIMIT_RTTIME 15 @@ -484,12 +483,6 @@ int main(int argc, char **argv) RAW_OPTION, NOHEADINGS_OPTION }; - enum { - EXCL_NONE, - EXCL_COMMAND, - EXCL_PID - }; - int excl_pcom = EXCL_NONE; static const struct option longopts[] = { { "pid", required_argument, NULL, 'p' }, @@ -585,7 +578,8 @@ int main(int argc, char **argv) break; case 'p': - exclusive_option(&excl_pcom, EXCL_PID + optind, _("--pid and --pid")); + if (pid) + errx(EXIT_FAILURE, _("only one --pid option may be specified.")); pid = strtos32_or_err(optarg, _("invalid PID argument")); break; case 'h': @@ -616,8 +610,7 @@ int main(int argc, char **argv) } } if (argc > optind && pid) - exclusive_option(&excl_pcom, EXCL_COMMAND, - _("--pid and COMMAND")); + errx(EXIT_FAILURE, _("options --pid and COMMAND are mutually exclusive.")); if (!ncolumns) { /* default columns */ columns[ncolumns++] = COL_RES; |