summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-09-05 10:22:45 -0700
committerMax Romanov <max.romanov@nginx.com>2017-09-05 10:22:45 -0700
commit1429cacd1738e6d3dde3a155228c4109de50984a (patch)
tree1f79c49e2e7b769051975e06182f5aa16dfbeb05 /src
parentf1685e371fe8a3bb9442fe2c5e0e33f5da0ac4f9 (diff)
downloadunit-1429cacd1738e6d3dde3a155228c4109de50984a.tar.gz
unit-1429cacd1738e6d3dde3a155228c4109de50984a.tar.bz2
Using CSTRZ mapping type for go executable.
Diffstat (limited to '')
-rw-r--r--src/nxt_application.h2
-rw-r--r--src/nxt_go.c12
-rw-r--r--src/nxt_main_process.c2
3 files changed, 6 insertions, 10 deletions
diff --git a/src/nxt_application.h b/src/nxt_application.h
index ca968299..38bd79f2 100644
--- a/src/nxt_application.h
+++ b/src/nxt_application.h
@@ -47,7 +47,7 @@ typedef struct {
typedef struct {
- nxt_str_t executable;
+ char *executable;
} nxt_go_app_conf_t;
diff --git a/src/nxt_go.c b/src/nxt_go.c
index 28d681ee..37f4de01 100644
--- a/src/nxt_go.c
+++ b/src/nxt_go.c
@@ -38,7 +38,6 @@ nxt_sock_no_cloexec(nxt_socket_t fd)
static nxt_int_t
nxt_go_init(nxt_task_t *task, nxt_common_app_conf_t *conf)
{
- char *go_path;
char *argv[2];
u_char buf[256];
u_char *p;
@@ -86,16 +85,13 @@ nxt_go_init(nxt_task_t *task, nxt_common_app_conf_t *conf)
setenv("NXT_GO_PORTS", (char *)buf, 1);
- go_path = malloc(c->executable.length + 1);
- nxt_memcpy(go_path, c->executable.start, c->executable.length);
- go_path[c->executable.length] = '\0';
-
- argv[0] = go_path;
+ argv[0] = c->executable;
argv[1] = NULL;
- (void) execve(go_path, argv, environ);
+ (void) execve(c->executable, argv, environ);
- nxt_log(task, NXT_LOG_WARN, "execve(%s) failed %E", go_path, nxt_errno);
+ nxt_log(task, NXT_LOG_WARN, "execve(%s) failed %E", c->executable,
+ nxt_errno);
return NXT_ERROR;
}
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index a7e1adb1..305daf8f 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -148,7 +148,7 @@ static nxt_conf_map_t nxt_common_app_conf[] = {
{
nxt_string("executable"),
- NXT_CONF_MAP_STR,
+ NXT_CONF_MAP_CSTRZ,
offsetof(nxt_common_app_conf_t, u.go.executable),
},
};