summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nginx/src
diff options
context:
space:
mode:
authorrobert <robert@openbsd.org>2012-06-26 10:03:41 +0000
committerrobert <robert@openbsd.org>2012-06-26 10:03:41 +0000
commit7e96c87a0b7f8a1c0f8435ff82919255d569a48c (patch)
tree647523b2699070bd3a19816d6084d0ee2c3aeb55 /usr.sbin/nginx/src
parentImprove compliance for <arpa/inet.h> and <netinet/in.h> to define/declare (diff)
downloadwireguard-openbsd-7e96c87a0b7f8a1c0f8435ff82919255d569a48c.tar.xz
wireguard-openbsd-7e96c87a0b7f8a1c0f8435ff82919255d569a48c.zip
use /var/www/tmp/ for the temp directories even if not chrooted
Diffstat (limited to 'usr.sbin/nginx/src')
-rw-r--r--usr.sbin/nginx/src/core/ngx_file.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/usr.sbin/nginx/src/core/ngx_file.c b/usr.sbin/nginx/src/core/ngx_file.c
index e37f5f57f1b..94f272e570e 100644
--- a/usr.sbin/nginx/src/core/ngx_file.c
+++ b/usr.sbin/nginx/src/core/ngx_file.c
@@ -474,7 +474,6 @@ ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
ngx_err_t err;
ngx_uint_t i;
ngx_path_t **path;
- char *buf = NULL;
path = cycle->pathes.elts;
for (i = 0; i < cycle->pathes.nelts; i++) {
@@ -485,17 +484,17 @@ ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
"chdir(\"%s\") failed", NGX_PREFIX);
return NGX_ERROR;
}
- buf = path[i]->name.data + 1;
- } else {
- buf = path[i]->name.data;
- }
+ ngx_strip_chroot(&path[i]->name);
+ path[i]->name.data++;
+ path[i]->name.len--;
+ }
- if (ngx_create_dir(buf, 0700) == NGX_FILE_ERROR) {
+ if (ngx_create_dir(path[i]->name.data, 0700) == NGX_FILE_ERROR) {
err = ngx_errno;
if (err != NGX_EEXIST) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, err,
ngx_create_dir_n " \"%s\" failed",
- buf);
+ path[i]->name.data);
return NGX_ERROR;
}
}
@@ -508,19 +507,19 @@ ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
{
ngx_file_info_t fi;
- if (ngx_file_info((const char *) buf, &fi)
+ if (ngx_file_info((const char *) path[i]->name.data, &fi)
== NGX_FILE_ERROR)
{
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
- ngx_file_info_n " \"%s\" failed", buf);
+ ngx_file_info_n " \"%s\" failed", path[i]->name.data);
return NGX_ERROR;
}
if (fi.st_uid != user) {
- if (chown((const char *) buf, user, -1) == -1) {
+ if (chown((const char *) path[i]->name.data, user, -1) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
"chown(\"%s\", %d) failed",
- buf, user);
+ path[i]->name.data, user);
return NGX_ERROR;
}
}
@@ -530,9 +529,9 @@ ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
{
fi.st_mode |= (S_IRUSR|S_IWUSR|S_IXUSR);
- if (chmod((const char *) buf, fi.st_mode) == -1) {
+ if (chmod((const char *) path[i]->name.data, fi.st_mode) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
- "chmod() \"%s\" failed", buf);
+ "chmod() \"%s\" failed", path[i]->name.data);
return NGX_ERROR;
}
}