mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 14:13:33 -06:00
use ngx_vslprintf(), ngx_slprintf()
This commit is contained in:
parent
4e1fe03e03
commit
e1c9746e37
@ -961,7 +961,7 @@ ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err,
|
||||
last = errstr + NGX_MAX_CONF_ERRSTR;
|
||||
|
||||
va_start(args, fmt);
|
||||
p = ngx_vsnprintf(errstr, last - errstr, fmt, args);
|
||||
p = ngx_vslprintf(errstr, last, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if (err) {
|
||||
@ -977,10 +977,10 @@ ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err,
|
||||
}
|
||||
|
||||
#if (NGX_WIN32)
|
||||
p = ngx_snprintf(p, last - p, ((unsigned) err < 0x80000000)
|
||||
? " (%d: " : " (%Xd: ", err);
|
||||
p = ngx_slprintf(p, last, ((unsigned) err < 0x80000000)
|
||||
? " (%d: " : " (%Xd: ", err);
|
||||
#else
|
||||
p = ngx_snprintf(p, last - p, " (%d: ", err);
|
||||
p = ngx_slprintf(p, last, " (%d: ", err);
|
||||
#endif
|
||||
|
||||
p = ngx_strerror_r(err, p, last - p);
|
||||
|
@ -101,14 +101,14 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
|
||||
|
||||
p = errstr + ngx_cached_err_log_time.len;
|
||||
|
||||
p = ngx_snprintf(p, last - p, " [%V] ", &err_levels[level]);
|
||||
p = ngx_slprintf(p, last, " [%V] ", &err_levels[level]);
|
||||
|
||||
/* pid#tid */
|
||||
p = ngx_snprintf(p, last - p, "%P#" NGX_TID_T_FMT ": ",
|
||||
p = ngx_slprintf(p, last, "%P#" NGX_TID_T_FMT ": ",
|
||||
ngx_log_pid, ngx_log_tid);
|
||||
|
||||
if (log->connection) {
|
||||
p = ngx_snprintf(p, last - p, "*%uA ", log->connection);
|
||||
p = ngx_slprintf(p, last, "*%uA ", log->connection);
|
||||
}
|
||||
|
||||
msg = p;
|
||||
@ -116,12 +116,12 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
|
||||
#if (NGX_HAVE_VARIADIC_MACROS)
|
||||
|
||||
va_start(args, fmt);
|
||||
p = ngx_vsnprintf(p, last - p, fmt, args);
|
||||
p = ngx_vslprintf(p, last, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
#else
|
||||
|
||||
p = ngx_vsnprintf(p, last - p, fmt, args);
|
||||
p = ngx_vslprintf(p, last, fmt, args);
|
||||
|
||||
#endif
|
||||
|
||||
@ -138,10 +138,10 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
|
||||
}
|
||||
|
||||
#if (NGX_WIN32)
|
||||
p = ngx_snprintf(p, last - p, ((unsigned) err < 0x80000000)
|
||||
? " (%d: " : " (%Xd: ", err);
|
||||
p = ngx_slprintf(p, last, ((unsigned) err < 0x80000000)
|
||||
? " (%d: " : " (%Xd: ", err);
|
||||
#else
|
||||
p = ngx_snprintf(p, last - p, " (%d: ", err);
|
||||
p = ngx_slprintf(p, last, " (%d: ", err);
|
||||
#endif
|
||||
|
||||
p = ngx_strerror_r(err, p, last - p);
|
||||
@ -230,8 +230,10 @@ ngx_log_stderr(ngx_err_t err, const char *fmt, ...)
|
||||
va_list args;
|
||||
u_char errstr[NGX_MAX_ERROR_STR];
|
||||
|
||||
last = errstr + NGX_MAX_ERROR_STR;
|
||||
|
||||
va_start(args, fmt);
|
||||
p = ngx_vsnprintf(errstr, NGX_MAX_ERROR_STR, fmt, args);
|
||||
p = ngx_vslprintf(errstr, last, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if (p > errstr + NGX_MAX_ERROR_STR - NGX_LINEFEED_SIZE) {
|
||||
@ -240,8 +242,6 @@ ngx_log_stderr(ngx_err_t err, const char *fmt, ...)
|
||||
|
||||
if (err) {
|
||||
|
||||
last = errstr + NGX_MAX_ERROR_STR;
|
||||
|
||||
if (p > last - 50) {
|
||||
|
||||
/* leave a space for an error code */
|
||||
@ -253,10 +253,10 @@ ngx_log_stderr(ngx_err_t err, const char *fmt, ...)
|
||||
}
|
||||
|
||||
#if (NGX_WIN32)
|
||||
p = ngx_snprintf(p, last - p, ((unsigned) err < 0x80000000)
|
||||
? " (%d: " : " (%Xd: ", err);
|
||||
p = ngx_slprintf(p, last, ((unsigned) err < 0x80000000)
|
||||
? " (%d: " : " (%Xd: ", err);
|
||||
#else
|
||||
p = ngx_snprintf(p, last - p, " (%d: ", err);
|
||||
p = ngx_slprintf(p, last, " (%d: ", err);
|
||||
#endif
|
||||
|
||||
p = ngx_strerror_r(err, p, last - p);
|
||||
|
@ -1306,7 +1306,7 @@ ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, char *fmt, ...)
|
||||
last = errstr + NGX_MAX_CONF_ERRSTR;
|
||||
|
||||
va_start(args, fmt);
|
||||
p = ngx_vsnprintf(errstr, sizeof(errstr) - 1, fmt, args);
|
||||
p = ngx_vslprintf(errstr, last - 1, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
p = ngx_cpystrn(p, (u_char *) " (SSL:", last - p);
|
||||
|
@ -22,17 +22,16 @@ ngx_event_log(ngx_err_t err, const char *fmt, ...)
|
||||
const char *msgarg[9];
|
||||
static u_char netmsg[] = "%SystemRoot%\\System32\\netmsg.dll";
|
||||
|
||||
last = text + NGX_MAX_ERROR_STR;
|
||||
p = text + GetModuleFileName(NULL, (char *) text, NGX_MAX_ERROR_STR - 50);
|
||||
|
||||
*p++ = ':';
|
||||
ngx_linefeed(p);
|
||||
|
||||
va_start(args, fmt);
|
||||
p = ngx_vsnprintf(p, NGX_MAX_ERROR_STR, fmt, args);
|
||||
p = ngx_vslprintf(p, last, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
last = text + NGX_MAX_ERROR_STR;
|
||||
|
||||
if (err) {
|
||||
|
||||
if (p > last - 50) {
|
||||
@ -45,8 +44,8 @@ ngx_event_log(ngx_err_t err, const char *fmt, ...)
|
||||
*p++ = '.';
|
||||
}
|
||||
|
||||
p = ngx_snprintf(p, last - p, ((unsigned) err < 0x80000000)
|
||||
? " (%d: " : " (%Xd: ", err);
|
||||
p = ngx_slprintf(p, last, ((unsigned) err < 0x80000000)
|
||||
? " (%d: " : " (%Xd: ", err);
|
||||
p = ngx_strerror_r(err, p, last - p);
|
||||
|
||||
if (p < last) {
|
||||
|
Loading…
Reference in New Issue
Block a user