diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2012-06-26 10:03:42 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2012-06-26 10:03:42 +0000 |
commit | 0d07c94bcc8c28c885c5dd111ffdfe69f1e004d5 (patch) | |
tree | fda2bc9674bee387f96cab817608623aca9a3a43 /usr.sbin | |
parent | b93f3e46d88799f1117ba872ab654d1a0e2da3fd (diff) |
use /var/www/tmp/ for the temp directories even if not chrooted
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/nginx/Makefile.bsd-wrapper | 12 | ||||
-rw-r--r-- | usr.sbin/nginx/src/core/ngx_file.c | 25 |
2 files changed, 18 insertions, 19 deletions
diff --git a/usr.sbin/nginx/Makefile.bsd-wrapper b/usr.sbin/nginx/Makefile.bsd-wrapper index a70bc9d60fb..8c740c62560 100644 --- a/usr.sbin/nginx/Makefile.bsd-wrapper +++ b/usr.sbin/nginx/Makefile.bsd-wrapper @@ -1,5 +1,5 @@ # Build wrapper for Nginx -# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2012/04/10 15:50:38 miod Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.6 2012/06/26 10:03:41 robert Exp $ LNDIR= /usr/bin/lndir @@ -16,11 +16,11 @@ CONFIGURE_ARGS= --prefix=/var/www \ --lock-path=/var/run/nginx.lock \ --http-log-path=logs/access.log \ --error-log-path=logs/error.log \ - --http-client-body-temp-path=/tmp/client_body_temp \ - --http-proxy-temp-path=/tmp/proxy_temp \ - --http-fastcgi-temp-path=/tmp/fastcgi_temp \ - --http-scgi-temp-path=/tmp/scgi_temp \ - --http-uwsgi-temp-path=/tmp/uwsgi_temp \ + --http-client-body-temp-path=/var/www/tmp/client_body_temp \ + --http-proxy-temp-path=/var/www/tmp/proxy_temp \ + --http-fastcgi-temp-path=/var/www/tmp/fastcgi_temp \ + --http-scgi-temp-path=/var/www/tmp/scgi_temp \ + --http-uwsgi-temp-path=/var/www/tmp/uwsgi_temp \ --user=www \ --group=www \ --with-http_gzip_static_module \ 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; } } |