Mercurial > hg > nginx
diff src/core/ngx_cycle.c @ 237:8d5cce3ae221
nginx-0.0.1-2004-01-22-20:10:46 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 22 Jan 2004 17:10:46 +0000 |
parents | 86e473b5641e |
children | 2a0540287298 |
line wrap: on
line diff
--- 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 } -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,