aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ngx_file.c')
-rw-r--r--src/core/ngx_file.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index 455b785fd..538adff1d 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -164,3 +164,44 @@ int ngx_next_temp_number(int collision)
return ngx_temp_number++;
}
+
+
+char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+ char *p = conf;
+
+ int i, n;
+ ngx_str_t *value;
+ ngx_path_t *path, **pp;
+
+ pp = (ngx_path_t **) (p + cmd->offset);
+
+ if (*pp) {
+ return "is duplicate";
+ }
+
+ ngx_test_null(path, ngx_pcalloc(cf->pool, sizeof(ngx_path_t)), NULL);
+
+ *pp = path;
+
+ value = (ngx_str_t *) cf->args->elts;
+
+ path->name = value[1];
+
+ path->len = 0;
+
+ for (i = 0, n = 2; n < cf->args->nelts; i++, n++) {
+ path->level[i] = ngx_atoi(value[n].data, value[n].len);
+ if (path->level[i] == NGX_ERROR || path->level[i] == 0) {
+ return "invalid value";
+ }
+
+ path->len += path->level[i] + 1;
+ }
+
+ while (i < 3) {
+ path->level[i++] = 0;
+ }
+
+ return NULL;
+}