From 54c80845ea1240336dc0c91ac0961687b6122789 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 22 Jan 2004 17:10:46 +0000 Subject: nginx-0.0.1-2004-01-22-20:10:46 import --- src/core/ngx_cycle.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/core/ngx_cycle.c') 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, -- cgit