comparison src/core/ngx_cycle.c @ 449:3b1e8c9df9ad

nginx-0.1.0-2004-10-04-00:02:06 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 03 Oct 2004 20:02:06 +0000
parents 241dc8092a33
children 23fb87bddda1
comparison
equal deleted inserted replaced
448:241dc8092a33 449:3b1e8c9df9ad
326 failed = 1; 326 failed = 1;
327 } 327 }
328 } 328 }
329 } 329 }
330 330
331 #if !(WIN32)
332
333 if (!failed && !ngx_test_config && cycle->log->file->fd != STDERR_FILENO) {
334
335 ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,
336 "dup2: %0X %d \"%s\"",
337 cycle->log->file,
338 cycle->log->file->fd, cycle->log->file->name.data);
339
340 if (dup2(cycle->log->file->fd, STDERR_FILENO) == NGX_ERROR) {
341 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
342 "dup2(STDERR) failed");
343 failed = 1;
344 }
345 }
346
347 #endif
348
349 if (failed) { 331 if (failed) {
350 332
351 /* rollback the new cycle configuration */ 333 /* rollback the new cycle configuration */
352 334
353 part = &cycle->open_files.part; 335 part = &cycle->open_files.part;
362 part = part->next; 344 part = part->next;
363 file = part->elts; 345 file = part->elts;
364 i = 0; 346 i = 0;
365 } 347 }
366 348
367 if (file[i].fd == NGX_INVALID_FILE) { 349 if (file[i].fd == NGX_INVALID_FILE
350 || file[i].fd == ngx_stderr_fileno)
351 {
368 continue; 352 continue;
369 } 353 }
370 354
371 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) { 355 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
372 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 356 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
398 } 382 }
399 383
400 384
401 /* commit the new cycle configuration */ 385 /* commit the new cycle configuration */
402 386
387 #if !(WIN32)
388
389 if (!ngx_test_config && cycle->log->file->fd != STDERR_FILENO) {
390
391 ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,
392 "dup2: %0X %d \"%s\"",
393 cycle->log->file,
394 cycle->log->file->fd, cycle->log->file->name.data);
395
396 if (dup2(cycle->log->file->fd, STDERR_FILENO) == NGX_ERROR) {
397 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
398 "dup2(STDERR) failed");
399 /* fatal */
400 exit(1);
401 }
402 }
403
404 #endif
405
403 pool->log = cycle->log; 406 pool->log = cycle->log;
404
405 407
406 for (i = 0; ngx_modules[i]; i++) { 408 for (i = 0; ngx_modules[i]; i++) {
407 if (ngx_modules[i]->init_module) { 409 if (ngx_modules[i]->init_module) {
408 if (ngx_modules[i]->init_module(cycle) == NGX_ERROR) { 410 if (ngx_modules[i]->init_module(cycle) == NGX_ERROR) {
409 /* fatal */ 411 /* fatal */
444 part = part->next; 446 part = part->next;
445 file = part->elts; 447 file = part->elts;
446 i = 0; 448 i = 0;
447 } 449 }
448 450
449 if (file[i].fd == NGX_INVALID_FILE) { 451 if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr_fileno) {
450 continue; 452 continue;
451 } 453 }
452 454
453 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) { 455 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
454 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 456 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,