summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_runtime.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-08-24 17:43:31 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-08-24 17:43:31 +0300
commit8b4b52ae3b3c9400b3d7040a591203a0c1b74ec3 (patch)
tree0255f84d362fff3a2f52df8a300d13ec8c40a259 /src/nxt_runtime.c
parent1e53ff184c3b94e08bd17c7318ee73e2317684ad (diff)
downloadunit-8b4b52ae3b3c9400b3d7040a591203a0c1b74ec3.tar.gz
unit-8b4b52ae3b3c9400b3d7040a591203a0c1b74ec3.tar.bz2
Checking invalid command line options.
Diffstat (limited to 'src/nxt_runtime.c')
-rw-r--r--src/nxt_runtime.c9
1 files changed, 8 insertions, 1 deletions
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;