summaryrefslogtreecommitdiffhomepage
path: root/src/core/ngx_cycle.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-01-22 17:10:46 +0000
committerIgor Sysoev <igor@sysoev.ru>2004-01-22 17:10:46 +0000
commit54c80845ea1240336dc0c91ac0961687b6122789 (patch)
treeb5dc87159b54981fe4c5a861a507acc16139bc26 /src/core/ngx_cycle.c
parentd8e1f07a93c014d57b7be0fd24fbee1978c95451 (diff)
downloadnginx-54c80845ea1240336dc0c91ac0961687b6122789.tar.gz
nginx-54c80845ea1240336dc0c91ac0961687b6122789.tar.bz2
nginx-0.0.1-2004-01-22-20:10:46 import
Diffstat (limited to 'src/core/ngx_cycle.c')
-rw-r--r--src/core/ngx_cycle.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index 29a327054..dcae4a0c5 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -362,7 +362,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
}
-void ngx_reopen_files(ngx_cycle_t *cycle)
+void ngx_reopen_files(ngx_cycle_t *cycle, uid_t user)
{
ngx_fd_t fd;
ngx_int_t i;
@@ -387,6 +387,19 @@ void ngx_reopen_files(ngx_cycle_t *cycle)
continue;
}
+ if (user != (uid_t) -1) {
+ if (chown(file[i].name.data, user, -1) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
+ "chown \"%s\" failed", file[i].name.data);
+
+ if (ngx_close_file(fd) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
+ ngx_close_file_n " \"%s\" failed",
+ file[i].name.data);
+ }
+ }
+ }
+
#if (WIN32)
if (ngx_file_append_mode(fd) == NGX_ERROR) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,