changeset 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 0188c538bd60
children 5338da501733
files CHANGES CHANGES.ru src/core/nginx.c src/core/nginx.h src/core/ngx_times.c src/http/modules/perl/nginx.pm
diffstat 6 files changed, 28 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,13 @@
 
+Changes with nginx 0.5.10                                        26 Jan 2007
+
+    *) 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.
+
+
 Changes with nginx 0.5.9                                         25 Jan 2007
 
     *) Change: now the ngx_http_memcached_module uses the $memcached_key 
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,13 @@
 
+Изменения в nginx 0.5.10                                          26.01.2007
+
+    *) Исправление: во время обновления исполняемого файла новый процесс не 
+       наследовал слушающие сокеты; ошибка появилась в 0.5.9.
+
+    *) Исправление: при сборке с оптимизацией -O2 в рабочем процессе мог 
+       произойти segmentation fault; ошибка появилась в 0.5.1.
+
+
 Изменения в nginx 0.5.9                                           25.01.2007
 
     *) Изменение: модуль ngx_http_memcached_module теперь в качестве ключа 
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -423,15 +423,8 @@ ngx_set_environment(ngx_cycle_t *cycle, 
 
     ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
 
-    if (last) {
-        n = *last;
-
-    } else {
-        if (ccf->environment) {
-            return ccf->environment;
-        }
-
-        n = 0;
+    if (last == NULL && ccf->environment) {
+        return ccf->environment;
     }
 
     var = ccf->env.elts;
@@ -453,6 +446,8 @@ ngx_set_environment(ngx_cycle_t *cycle, 
 
 tz_found:
 
+    n = 0;
+
     for (i = 0; i < ccf->env.nelts; i++) {
 
         if (var[i].data[var[i].len] == '=') {
@@ -472,8 +467,8 @@ tz_found:
     }
 
     if (last) {
+        env = ngx_alloc((*last + n + 1) * sizeof(char *), cycle->log);
         *last = n;
-        env = ngx_alloc((n + 1) * sizeof(char *), cycle->log);
 
     } else {
         env = ngx_palloc(cycle->pool, (n + 1) * sizeof(char *));
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VERSION      "0.5.9"
+#define NGINX_VERSION      "0.5.10"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -101,7 +101,7 @@ ngx_time_update(time_t sec, ngx_uint_t m
     ngx_gmtime(sec, &gmt);
 
 
-    p0 = cached_http_time[slot];
+    p0 = &cached_http_time[slot][0];
 
     (void) ngx_sprintf(p0, "%s, %02d %s %4d %02d:%02d:%02d GMT",
                        week[gmt.ngx_tm_wday], gmt.ngx_tm_mday,
@@ -126,7 +126,7 @@ ngx_time_update(time_t sec, ngx_uint_t m
 #endif
 
 
-    p1 = cached_err_log_time[slot];
+    p1 = &cached_err_log_time[slot][0];
 
     (void) ngx_sprintf(p1, "%4d/%02d/%02d %02d:%02d:%02d",
                        tm.ngx_tm_year, tm.ngx_tm_mon,
@@ -134,7 +134,7 @@ ngx_time_update(time_t sec, ngx_uint_t m
                        tm.ngx_tm_min, tm.ngx_tm_sec);
 
 
-    p2 = cached_http_log_time[slot];
+    p2 = &cached_http_log_time[slot][0];
 
     (void) ngx_sprintf(p2, "%02d/%s/%d:%02d:%02d:%02d %c%02d%02d",
                        tm.ngx_tm_mday, months[tm.ngx_tm_mon - 1],
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -47,7 +47,7 @@ our @EXPORT = qw(
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '0.5.9';
+our $VERSION = '0.5.10';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);