summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_php_sapi.c
diff options
context:
space:
mode:
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);