Fixed the previous commit.

This commit is contained in:
Valentin Bartenev
2017-07-14 17:03:01 +03:00
parent a937047cb8
commit d669045b75

View File

@@ -317,19 +317,25 @@ nxt_master_start_worker_process(nxt_task_t *task, nxt_runtime_t *rt,
return NXT_ERROR; return NXT_ERROR;
} }
init->user_cred = (nxt_user_cred_t *) (init + 1);
user = nxt_pointer_to(init->user_cred, sizeof(nxt_user_cred_t)); user = nxt_pointer_to(init->user_cred, sizeof(nxt_user_cred_t));
nxt_memcpy(user, app_conf->user.start, app_conf->user.length); nxt_memcpy(user, app_conf->user.start, app_conf->user.length);
user[app_conf->user.length] = '\0'; user[app_conf->user.length] = '\0';
init->user_cred->user = user;
if (app_conf->group.start != NULL) {
group = nxt_pointer_to(user, app_conf->user.length + 1); group = nxt_pointer_to(user, app_conf->user.length + 1);
nxt_memcpy(group, app_conf->group.start, app_conf->group.length); nxt_memcpy(group, app_conf->group.start, app_conf->group.length);
group[app_conf->group.length] = '\0'; group[app_conf->group.length] = '\0';
init->user_cred = (nxt_user_cred_t *) (init + 1); } else {
group = NULL;
}
init->user_cred->user = user;
if (nxt_user_cred_get(task, init->user_cred, group) != NXT_OK) { if (nxt_user_cred_get(task, init->user_cred, group) != NXT_OK) {
return NXT_ERROR; return NXT_ERROR;
} }