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.
This commit is contained in:
Valentin Bartenev
2018-02-09 19:06:53 +03:00
parent c890f53d10
commit 9d683d37b1

View File

@@ -21,8 +21,8 @@ typedef struct {
typedef struct { typedef struct {
nxt_int_t size; nxt_uint_t size;
nxt_conf_map_t *map; nxt_conf_map_t *map;
} nxt_common_app_member_t; } 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 static void
nxt_port_main_start_worker_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) 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_mp_t *mp;
nxt_int_t ret, idx; nxt_int_t ret;
nxt_buf_t *b; nxt_buf_t *b;
nxt_port_t *port; nxt_port_t *port;
nxt_app_type_t idx;
nxt_conf_value_t *conf; nxt_conf_value_t *conf;
nxt_common_app_conf_t app_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; 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); nxt_assert(idx != NXT_APP_UNKNOWN);