summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_runtime.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2018-09-20 15:27:08 +0300
committerValentin Bartenev <vbart@nginx.com>2018-09-20 15:27:08 +0300
commit8d844bc2aa78d5acc789c5865a62bedbeba76902 (patch)
treecbc6e225402434d5b14cb454a2b7c02cebc93bbf /src/nxt_runtime.c
parent2dfd8ffc2fa36712c8987afa870c355185d61af9 (diff)
downloadunit-8d844bc2aa78d5acc789c5865a62bedbeba76902.tar.gz
unit-8d844bc2aa78d5acc789c5865a62bedbeba76902.tar.bz2
Controller: certificates storage interface.
Diffstat (limited to 'src/nxt_runtime.c')
-rw-r--r--src/nxt_runtime.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index acc2820a..311c2c08 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -762,6 +762,23 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt)
rt->conf_tmp = (char *) file_name.start;
+ ret = nxt_file_name_create(rt->mem_pool, &file_name, "%s%scerts/%Z",
+ rt->state, slash);
+ if (nxt_slow_path(ret != NXT_OK)) {
+ return NXT_ERROR;
+ }
+
+ ret = mkdir((char *) file_name.start, S_IRWXU);
+
+ if (nxt_fast_path(ret == 0 || nxt_errno == EEXIST)) {
+ rt->certs.length = file_name.len;
+ rt->certs.start = file_name.start;
+
+ } else {
+ nxt_alert(task, "Unable to create certificates storage directory: "
+ "mkdir(%s) failed %E", file_name.start, nxt_errno);
+ }
+
control.length = nxt_strlen(rt->control);
control.start = (u_char *) rt->control;