diff options
Diffstat (limited to 'src/core/ngx_cycle.c')
-rw-r--r-- | src/core/ngx_cycle.c | 15 |
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, |