diff src/core/ngx_log.c @ 604:428c6e58046a NGINX_0_9_0

nginx 0.9.0 *) Feature: the "keepalive_disable" directive. *) Feature: the "map" directive supports variables as value of a defined variable. *) Feature: the "map" directive supports empty strings as value of the first parameter. *) Feature: the "map" directive supports expressions as the first parameter. *) Feature: nginx(8) manual page. Thanks to Sergey Osokin. *) Feature: Linux accept4() support. Thanks to Simon Liu. *) Workaround: elimination of Linux linker warning about "sys_errlist" and "sys_nerr"; the warning had appeared in 0.8.35. *) Bugfix: a segmentation fault might occur in a worker process, if the "auth_basic" directive was used. Thanks to Michail Laletin. *) Bugfix: compatibility with ngx_http_eval_module; the bug had appeared in 0.8.42.
author Igor Sysoev <http://sysoev.ru>
date Mon, 29 Nov 2010 00:00:00 +0300
parents 8246d8a2c2be
children 7ea1bba9a4f6
line wrap: on
line diff
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -148,9 +148,9 @@ ngx_log_error_core(ngx_uint_t level, ngx
         return;
     }
 
-    msg -= (err_levels[level].len + 4);
+    msg -= (7 + err_levels[level].len + 4);
 
-    (void) ngx_sprintf(msg, "[%V]: ", &err_levels[level]);
+    (void) ngx_sprintf(msg, "nginx: [%V]: ", &err_levels[level]);
 
     (void) ngx_write_console(ngx_stderr, msg, p - msg);
 }
@@ -209,9 +209,12 @@ ngx_log_stderr(ngx_err_t err, const char
     u_char    errstr[NGX_MAX_ERROR_STR];
 
     last = errstr + NGX_MAX_ERROR_STR;
+    p = errstr + 7;
+
+    ngx_memcpy(errstr, "nginx: ", 7);
 
     va_start(args, fmt);
-    p = ngx_vslprintf(errstr, last, fmt, args);
+    p = ngx_vslprintf(p, last, fmt, args);
     va_end(args);
 
     if (err) {
@@ -248,7 +251,7 @@ ngx_log_errno(u_char *buf, u_char *last,
     buf = ngx_slprintf(buf, last, " (%d: ", err);
 #endif
 
-    buf = ngx_strerror_r(err, buf, last - buf);
+    buf = ngx_strerror(err, buf, last - buf);
 
     if (buf < last) {
         *buf++ = ')';