comparison src/os/win32/ngx_event_log.c @ 2764:d4a717592877

use ngx_vslprintf(), ngx_slprintf()
author Igor Sysoev <igor@sysoev.ru>
date Mon, 27 Apr 2009 13:06:20 +0000
parents d43d73277c5c
children 6d358aeaa989
comparison
equal deleted inserted replaced
2763:819bea4e964e 2764:d4a717592877
20 va_list args; 20 va_list args;
21 u_char text[NGX_MAX_ERROR_STR]; 21 u_char text[NGX_MAX_ERROR_STR];
22 const char *msgarg[9]; 22 const char *msgarg[9];
23 static u_char netmsg[] = "%SystemRoot%\\System32\\netmsg.dll"; 23 static u_char netmsg[] = "%SystemRoot%\\System32\\netmsg.dll";
24 24
25 last = text + NGX_MAX_ERROR_STR;
25 p = text + GetModuleFileName(NULL, (char *) text, NGX_MAX_ERROR_STR - 50); 26 p = text + GetModuleFileName(NULL, (char *) text, NGX_MAX_ERROR_STR - 50);
26 27
27 *p++ = ':'; 28 *p++ = ':';
28 ngx_linefeed(p); 29 ngx_linefeed(p);
29 30
30 va_start(args, fmt); 31 va_start(args, fmt);
31 p = ngx_vsnprintf(p, NGX_MAX_ERROR_STR, fmt, args); 32 p = ngx_vslprintf(p, last, fmt, args);
32 va_end(args); 33 va_end(args);
33
34 last = text + NGX_MAX_ERROR_STR;
35 34
36 if (err) { 35 if (err) {
37 36
38 if (p > last - 50) { 37 if (p > last - 50) {
39 38
43 *p++ = '.'; 42 *p++ = '.';
44 *p++ = '.'; 43 *p++ = '.';
45 *p++ = '.'; 44 *p++ = '.';
46 } 45 }
47 46
48 p = ngx_snprintf(p, last - p, ((unsigned) err < 0x80000000) 47 p = ngx_slprintf(p, last, ((unsigned) err < 0x80000000)
49 ? " (%d: " : " (%Xd: ", err); 48 ? " (%d: " : " (%Xd: ", err);
50 p = ngx_strerror_r(err, p, last - p); 49 p = ngx_strerror_r(err, p, last - p);
51 50
52 if (p < last) { 51 if (p < last) {
53 *p++ = ')'; 52 *p++ = ')';
54 } 53 }