Mercurial > hg > nginx
diff src/core/ngx_log.c @ 571:458b6c3fea65 release-0.3.7
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.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 27 Oct 2005 15:46:13 +0000 |
parents | b09ee85d0ac8 |
children | 4d9ea73a627a |
line wrap: on
line diff
--- a/src/core/ngx_log.c Mon Oct 24 15:09:41 2005 +0000 +++ b/src/core/ngx_log.c Thu Oct 27 15:46:13 2005 +0000 @@ -8,7 +8,6 @@ #include <ngx_core.h> -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 @@ 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); - -#if 0 - if (WriteFile(log->file->fd, errstr, len, &written, NULL) == 0) { - ngx_message_box("nginx", MB_OK, ngx_errno, "WriteFile() failed"); - } -#endif + ngx_linefeed(p); -#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); }