From 8b4b52ae3b3c9400b3d7040a591203a0c1b74ec3 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 24 Aug 2017 17:43:31 +0300 Subject: Checking invalid command line options. --- src/nxt_runtime.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/nxt_runtime.c') diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c index ff4dd54d..fcae4ed8 100644 --- a/src/nxt_runtime.c +++ b/src/nxt_runtime.c @@ -794,14 +794,16 @@ static nxt_int_t nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt) { char *p, **argv; + u_char *end; nxt_str_t addr; nxt_sockaddr_t *sa; + u_char buf[1024]; const static char version[] = "nginext version: " NXT_VERSION "\n" "configured as ./configure" NXT_CONFIGURE_OPTIONS "\n"; - argv = nxt_process_argv; + argv = &nxt_process_argv[1]; while (*argv != NULL) { p = *argv++; @@ -909,6 +911,11 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt) write(STDERR_FILENO, version, sizeof(version) - 1); exit(0); } + + end = nxt_sprintf(buf, buf + sizeof(buf), "unknown option \"%s\"\n", p); + write(STDERR_FILENO, buf, end - buf); + + return NXT_ERROR; } return NXT_OK; -- cgit