From 697d1aea0c7b1525beed2911f9f32426280df8f4 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 27 Oct 2005 15:46:13 +0000 Subject: nginx-0.3.7-RELEASE import *) Feature: the "access_log" supports the "buffer=" parameter. *) Bugfix: nginx could not be built on platforms different from i386, amd64, sparc, and ppc; the bug had appeared in 0.3.2. --- src/core/ngx_log.c | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) (limited to 'src/core/ngx_log.c') diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c index 905c8a165..444e943c5 100644 --- a/src/core/ngx_log.c +++ b/src/core/ngx_log.c @@ -8,7 +8,6 @@ #include -static void ngx_log_write(ngx_log_t *log, u_char *errstr, size_t len); static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); @@ -152,42 +151,13 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, p = log->handler(log, p, last - p); } - ngx_log_write(log, errstr, p - errstr); -} - - -static void -ngx_log_write(ngx_log_t *log, u_char *errstr, size_t len) -{ -#if (NGX_WIN32) - u_long written; - - if (len >= NGX_MAX_ERROR_STR - 1) { - len = NGX_MAX_ERROR_STR - 2; + if (p > last - NGX_LINEFEED_SIZE) { + p = last - NGX_LINEFEED_SIZE; } - errstr[len++] = CR; - errstr[len++] = LF; - - WriteFile(log->file->fd, errstr, len, &written, NULL); + ngx_linefeed(p); -#if 0 - if (WriteFile(log->file->fd, errstr, len, &written, NULL) == 0) { - ngx_message_box("nginx", MB_OK, ngx_errno, "WriteFile() failed"); - } -#endif - -#else - - if (len == NGX_MAX_ERROR_STR) { - len--; - } - - errstr[len++] = LF; - - (void) write(log->file->fd, errstr, len); - -#endif + ngx_write_fd(log->file->fd, errstr, p - errstr); } -- cgit