diff options
author | Valentin Bartenev <vbart@nginx.com> | 2018-02-09 19:06:53 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2018-02-09 19:06:53 +0300 |
commit | 9d683d37b162096b2329a28dbe2489535e029988 (patch) | |
tree | 707499e50fce4ccf43d19ecc8ef7e01c25b8bb43 /src/nxt_main_process.c | |
parent | c890f53d105a53c8e61f9668775fa804f6aae34a (diff) | |
download | unit-9d683d37b162096b2329a28dbe2489535e029988.tar.gz unit-9d683d37b162096b2329a28dbe2489535e029988.tar.bz2 |
Fixed starting of applications with specified version.
The "type" option can contain version number that need to be cut off before
calling nxt_app_parse_type().
The bug was introduced in 4979fe09d9cd.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_main_process.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c index 17a28faa..cb7a964e 100644 --- a/src/nxt_main_process.c +++ b/src/nxt_main_process.c @@ -21,8 +21,8 @@ typedef struct { typedef struct { - nxt_int_t size; - nxt_conf_map_t *map; + nxt_uint_t size; + nxt_conf_map_t *map; } nxt_common_app_member_t; @@ -201,11 +201,13 @@ nxt_port_main_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) static void nxt_port_main_start_worker_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) { - u_char *start; + u_char *start, ch; + size_t type_len; nxt_mp_t *mp; - nxt_int_t ret, idx; + nxt_int_t ret; nxt_buf_t *b; nxt_port_t *port; + nxt_app_type_t idx; nxt_conf_value_t *conf; nxt_common_app_conf_t app_conf; @@ -254,7 +256,15 @@ nxt_port_main_start_worker_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) goto failed; } - idx = nxt_app_parse_type(app_conf.type.start, app_conf.type.length); + for (type_len = 0; type_len != app_conf.type.length; type_len++) { + ch = app_conf.type.start[type_len]; + + if (ch == ' ' || nxt_isdigit(ch)) { + break; + } + } + + idx = nxt_app_parse_type(app_conf.type.start, type_len); nxt_assert(idx != NXT_APP_UNKNOWN); |