diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/main.c | 10 | ||||
-rw-r--r-- | src/core/shutdown.c | 9 |
2 files changed, 6 insertions, 13 deletions
diff --git a/src/core/main.c b/src/core/main.c index e9909ded5b..d2104cb551 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -952,13 +952,13 @@ static int parse_argv(int argc, char *argv[]) { * parse_proc_cmdline_word() or ignore. */ case '?': - default: - if (getpid() != 1) { - log_error("Unknown option code %c", c); + if (getpid() != 1) return -EINVAL; - } + else + return 0; - break; + default: + assert_not_reached("Unhandled option code."); } if (optind < argc && getpid() != 1) { diff --git a/src/core/shutdown.c b/src/core/shutdown.c index fde3ce9c27..1abc140e7d 100644 --- a/src/core/shutdown.c +++ b/src/core/shutdown.c @@ -74,9 +74,7 @@ static int parse_argv(int argc, char *argv[]) { assert(argc >= 1); assert(argv); - opterr = 0; - - while ((c = getopt_long(argc, argv, ":", options, NULL)) >= 0) + while ((c = getopt_long(argc, argv, "", options, NULL)) >= 0) switch (c) { case ARG_LOG_LEVEL: @@ -115,11 +113,6 @@ static int parse_argv(int argc, char *argv[]) { break; case '?': - log_error("Unknown option %s.", argv[optind-1]); - return -EINVAL; - - case ':': - log_error("Missing argument to %s.", argv[optind-1]); return -EINVAL; default: |