comparison src/core/nginx.c @ 280:fa73fb2d9427 NGINX_0_5_10

nginx 0.5.10 *) Bugfix: while online executable file upgrade the new master process did not inherit the listening sockets; bug appeared in 0.5.9. *) Bugfix: a segmentation fault might occur in worker process if nginx was built with -O2 optimization; bug appeared in 0.5.1.
author Igor Sysoev <http://sysoev.ru>
date Fri, 26 Jan 2007 00:00:00 +0300
parents 704622b2528a
children 24def6198d7f
comparison
equal deleted inserted replaced
279:0188c538bd60 280:fa73fb2d9427
421 ngx_uint_t i, n; 421 ngx_uint_t i, n;
422 ngx_core_conf_t *ccf; 422 ngx_core_conf_t *ccf;
423 423
424 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); 424 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
425 425
426 if (last) { 426 if (last == NULL && ccf->environment) {
427 n = *last; 427 return ccf->environment;
428
429 } else {
430 if (ccf->environment) {
431 return ccf->environment;
432 }
433
434 n = 0;
435 } 428 }
436 429
437 var = ccf->env.elts; 430 var = ccf->env.elts;
438 431
439 for (i = 0; i < ccf->env.nelts; i++) { 432 for (i = 0; i < ccf->env.nelts; i++) {
450 var->data = (u_char *) "TZ"; 443 var->data = (u_char *) "TZ";
451 444
452 var = ccf->env.elts; 445 var = ccf->env.elts;
453 446
454 tz_found: 447 tz_found:
448
449 n = 0;
455 450
456 for (i = 0; i < ccf->env.nelts; i++) { 451 for (i = 0; i < ccf->env.nelts; i++) {
457 452
458 if (var[i].data[var[i].len] == '=') { 453 if (var[i].data[var[i].len] == '=') {
459 n++; 454 n++;
470 } 465 }
471 } 466 }
472 } 467 }
473 468
474 if (last) { 469 if (last) {
470 env = ngx_alloc((*last + n + 1) * sizeof(char *), cycle->log);
475 *last = n; 471 *last = n;
476 env = ngx_alloc((n + 1) * sizeof(char *), cycle->log);
477 472
478 } else { 473 } else {
479 env = ngx_palloc(cycle->pool, (n + 1) * sizeof(char *)); 474 env = ngx_palloc(cycle->pool, (n + 1) * sizeof(char *));
480 } 475 }
481 476