comparison 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
comparison
equal deleted inserted replaced
236:86e473b5641e 237:8d5cce3ae221
360 360
361 return cycle; 361 return cycle;
362 } 362 }
363 363
364 364
365 void ngx_reopen_files(ngx_cycle_t *cycle) 365 void ngx_reopen_files(ngx_cycle_t *cycle, uid_t user)
366 { 366 {
367 ngx_fd_t fd; 367 ngx_fd_t fd;
368 ngx_int_t i; 368 ngx_int_t i;
369 ngx_open_file_t *file; 369 ngx_open_file_t *file;
370 370
383 383
384 if (fd == NGX_INVALID_FILE) { 384 if (fd == NGX_INVALID_FILE) {
385 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 385 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
386 ngx_open_file_n " \"%s\" failed", file[i].name.data); 386 ngx_open_file_n " \"%s\" failed", file[i].name.data);
387 continue; 387 continue;
388 }
389
390 if (user != (uid_t) -1) {
391 if (chown(file[i].name.data, user, -1) == -1) {
392 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
393 "chown \"%s\" failed", file[i].name.data);
394
395 if (ngx_close_file(fd) == NGX_FILE_ERROR) {
396 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
397 ngx_close_file_n " \"%s\" failed",
398 file[i].name.data);
399 }
400 }
388 } 401 }
389 402
390 #if (WIN32) 403 #if (WIN32)
391 if (ngx_file_append_mode(fd) == NGX_ERROR) { 404 if (ngx_file_append_mode(fd) == NGX_ERROR) {
392 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 405 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,