summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_php_sapi.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2019-07-16 17:58:48 +0300
committerValentin Bartenev <vbart@nginx.com>2019-07-16 17:58:48 +0300
commitef89815f03ff27ae5ccf4d93ce10f08539a315bd (patch)
treec86e8957167cbd858a97839e3f057ed74614a2e2 /src/nxt_php_sapi.c
parentce1fbd927379abf7336171967d788f10692eef68 (diff)
downloadunit-ef89815f03ff27ae5ccf4d93ce10f08539a315bd.tar.gz
unit-ef89815f03ff27ae5ccf4d93ce10f08539a315bd.tar.bz2
PHP: fixed script filename setting, broken after 2a71417d297f.
Diffstat (limited to 'src/nxt_php_sapi.c')
-rw-r--r--src/nxt_php_sapi.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index 1551b05e..f5f115f5 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -180,7 +180,7 @@ static void ***tsrm_ls;
static nxt_int_t
nxt_php_init(nxt_task_t *task, nxt_common_app_conf_t *conf)
{
- u_char *p;
+ u_char *p, *tmp;
nxt_str_t ini_path;
nxt_str_t *root, *script_filename, *script_name, *index;
nxt_port_t *my_port, *main_port;
@@ -221,24 +221,26 @@ nxt_php_init(nxt_task_t *task, nxt_common_app_conf_t *conf)
if (c->script.length > 0) {
nxt_php_str_trim_lead(&c->script, '/');
- p = nxt_malloc(root->length + 1 + c->script.length + 1);
- if (nxt_slow_path(p == NULL)) {
+ tmp = nxt_malloc(root->length + 1 + c->script.length + 1);
+ if (nxt_slow_path(tmp == NULL)) {
return NXT_ERROR;
}
+ p = tmp;
+
p = nxt_cpymem(p, root->start, root->length);
*p++ = '/';
p = nxt_cpymem(p, c->script.start, c->script.length);
*p = '\0';
- script_filename->start = nxt_realpath(p);
+ script_filename->start = nxt_realpath(tmp);
if (nxt_slow_path(script_filename->start == NULL)) {
- nxt_alert(task, "script realpath(%s) failed %E", p, nxt_errno);
+ nxt_alert(task, "script realpath(%s) failed %E", tmp, nxt_errno);
return NXT_ERROR;
}
- nxt_free(p);
+ nxt_free(tmp);
script_filename->length = nxt_strlen(script_filename->start);