Skip to content

Commit

Permalink
fixed the compile warning with syslog_1.3.11.patch
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoweibin committed Jan 11, 2013
1 parent 2add874 commit 91e1e3f
Showing 1 changed file with 49 additions and 44 deletions.
93 changes: 49 additions & 44 deletions syslog_1.3.11.patch
@@ -1,6 +1,7 @@
diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_cycle.c nginx-1.3.11_b/src/core/ngx_cycle.c
--- nginx-1.3.11_a/src/core/ngx_cycle.c 2012-12-23 19:36:52.000000000 +0400
+++ nginx-1.3.11_b/src/core/ngx_cycle.c 2013-01-11 01:20:34.869954896 +0400
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index dc4dc89..46c4b4f 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -85,6 +85,12 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
cycle->pool = pool;
cycle->log = log;
Expand All @@ -14,9 +15,10 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_cycle.c nginx-1.3.11_b/src/core/ngx_c
cycle->old_cycle = old_cycle;

cycle->conf_prefix.len = old_cycle->conf_prefix.len;
diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.c nginx-1.3.11_b/src/core/ngx_log.c
--- nginx-1.3.11_a/src/core/ngx_log.c 2012-01-18 19:07:43.000000000 +0400
+++ nginx-1.3.11_b/src/core/ngx_log.c 2013-01-11 01:20:34.869954896 +0400
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index d7830fb..982c2ed 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -10,6 +10,15 @@


Expand All @@ -33,7 +35,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.c nginx-1.3.11_b/src/core/ngx_log


static ngx_command_t ngx_errlog_commands[] = {
@@ -21,6 +30,15 @@ static ngx_command_t ngx_errlog_command
@@ -21,6 +30,15 @@ static ngx_command_t ngx_errlog_commands[] = {
0,
NULL},

Expand Down Expand Up @@ -111,7 +113,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.c nginx-1.3.11_b/src/core/ngx_log

static ngx_str_t err_levels[] = {
ngx_null_string,
@@ -89,11 +153,16 @@ ngx_log_error_core(ngx_uint_t level, ngx
@@ -89,11 +153,16 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
va_list args;
#endif
u_char *p, *last, *msg;
Expand All @@ -128,7 +130,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.c nginx-1.3.11_b/src/core/ngx_log

last = errstr + NGX_MAX_ERROR_STR;

@@ -102,6 +171,10 @@ ngx_log_error_core(ngx_uint_t level, ngx
@@ -102,6 +171,10 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,

p = errstr + ngx_cached_err_log_time.len;

Expand All @@ -139,7 +141,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.c nginx-1.3.11_b/src/core/ngx_log
p = ngx_slprintf(p, last, " [%V] ", &err_levels[level]);

/* pid#tid */
@@ -140,11 +213,27 @@ ngx_log_error_core(ngx_uint_t level, ngx
@@ -140,11 +213,27 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,

ngx_linefeed(p);

Expand Down Expand Up @@ -167,7 +169,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.c nginx-1.3.11_b/src/core/ngx_log
{
return;
}
@@ -367,6 +456,50 @@ ngx_log_create(ngx_cycle_t *cycle, ngx_s
@@ -367,6 +456,50 @@ ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name)
}


Expand Down Expand Up @@ -232,7 +234,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.c nginx-1.3.11_b/src/core/ngx_log

if (cf->cycle->new_log.file) {
return "is duplicate";
@@ -436,7 +576,44 @@ ngx_error_log(ngx_conf_t *cf, ngx_comman
@@ -436,7 +576,44 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)

value = cf->args->elts;

Expand Down Expand Up @@ -277,7 +279,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.c nginx-1.3.11_b/src/core/ngx_log
ngx_str_null(&name);

} else {
@@ -457,3 +634,63 @@ ngx_error_log(ngx_conf_t *cf, ngx_comman
@@ -457,3 +634,63 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)

return ngx_log_set_levels(cf, &cf->cycle->new_log);
}
Expand Down Expand Up @@ -341,9 +343,10 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.c nginx-1.3.11_b/src/core/ngx_log
+}
+#endif
+
diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.h nginx-1.3.11_b/src/core/ngx_log.h
--- nginx-1.3.11_a/src/core/ngx_log.h 2012-01-18 19:07:43.000000000 +0400
+++ nginx-1.3.11_b/src/core/ngx_log.h 2013-01-11 01:20:34.869954896 +0400
diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
index 3233647..5e7fdbf 100644
--- a/src/core/ngx_log.h
+++ b/src/core/ngx_log.h
@@ -12,6 +12,13 @@
#include <ngx_config.h>
#include <ngx_core.h>
Expand Down Expand Up @@ -372,7 +375,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.h nginx-1.3.11_b/src/core/ngx_log
};


@@ -221,6 +235,10 @@ void ngx_cdecl ngx_log_debug_core(ngx_lo
@@ -221,6 +235,10 @@ void ngx_cdecl ngx_log_debug_core(ngx_log_t *log, ngx_err_t err,

ngx_log_t *ngx_log_init(u_char *prefix);
ngx_log_t *ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name);
Expand All @@ -383,9 +386,10 @@ diff -NaurBpwd nginx-1.3.11_a/src/core/ngx_log.h nginx-1.3.11_b/src/core/ngx_log
char *ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log);
void ngx_cdecl ngx_log_abort(ngx_err_t err, const char *fmt, ...);
void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...);
diff -NaurBpwd nginx-1.3.11_a/src/http/modules/ngx_http_log_module.c nginx-1.3.11_b/src/http/modules/ngx_http_log_module.c
--- nginx-1.3.11_a/src/http/modules/ngx_http_log_module.c 2012-12-23 23:09:33.000000000 +0400
+++ nginx-1.3.11_b/src/http/modules/ngx_http_log_module.c 2013-01-11 01:42:10.350024344 +0400
diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c
index aa6a3fc..deceb38 100644
--- a/src/http/modules/ngx_http_log_module.c
+++ b/src/http/modules/ngx_http_log_module.c
@@ -13,6 +13,11 @@
#include <zlib.h>
#endif
Expand All @@ -410,7 +414,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/http/modules/ngx_http_log_module.c nginx-1.3.1
} ngx_http_log_t;


@@ -348,6 +358,14 @@ ngx_http_log_write(ngx_http_request_t *r
@@ -348,6 +358,14 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
time_t now;
ssize_t n;
ngx_err_t err;
Expand All @@ -425,31 +429,30 @@ diff -NaurBpwd nginx-1.3.11_a/src/http/modules/ngx_http_log_module.c nginx-1.3.1
#if (NGX_ZLIB)
ngx_http_log_buf_t *buffer;
#endif
@@ -355,6 +373,14 @@ ngx_http_log_write(ngx_http_request_t *r
@@ -355,6 +373,9 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
if (log->script == NULL) {
name = log->file->name.data;

+#if (NGX_ENABLE_SYSLOG)
+ if (name != NULL) {
+ n = ngx_write_fd(log->file->fd, buf, len);
+ }
+ else {
+ n = len;
+ }
+#else
+#endif
#if (NGX_ZLIB)
buffer = log->file->data;

@@ -367,7 +393,7 @@ ngx_http_log_write(ngx_http_request_t *r
@@ -367,7 +388,11 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
#else
n = ngx_write_fd(log->file->fd, buf, len);
#endif
-
+#if (NGX_ENABLE_SYSLOG)
+ } else {
+ n = len;
+ }
+#endif
} else {
name = NULL;
n = ngx_http_log_script_write(r, log->script, &name, buf, len);
@@ -1068,6 +1094,10 @@ ngx_http_log_merge_loc_conf(ngx_conf_t *
@@ -1068,6 +1093,10 @@ ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
log->script = NULL;
log->disk_full_time = 0;
log->error_log_time = 0;
Expand All @@ -460,7 +463,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/http/modules/ngx_http_log_module.c nginx-1.3.1

lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
fmt = lmcf->formats.elts;
@@ -1096,6 +1126,13 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx
@@ -1096,6 +1125,13 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_http_log_main_conf_t *lmcf;
ngx_http_script_compile_t sc;

Expand All @@ -474,7 +477,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/http/modules/ngx_http_log_module.c nginx-1.3.1
value = cf->args->elts;

if (ngx_strcmp(value[1].data, "off") == 0) {
@@ -1108,6 +1145,38 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx
@@ -1108,6 +1144,38 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
"invalid parameter \"%V\"", &value[2]);
return NGX_CONF_ERROR;
}
Expand Down Expand Up @@ -513,7 +516,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/http/modules/ngx_http_log_module.c nginx-1.3.1

if (llcf->logs == NULL) {
llcf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t));
@@ -1125,6 +1194,52 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx
@@ -1125,6 +1193,52 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)

ngx_memzero(log, sizeof(ngx_http_log_t));

Expand Down Expand Up @@ -566,18 +569,19 @@ diff -NaurBpwd nginx-1.3.11_a/src/http/modules/ngx_http_log_module.c nginx-1.3.1
n = ngx_http_script_variables_count(&value[1]);

if (n == 0) {
@@ -1157,6 +1272,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx
@@ -1157,6 +1271,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_ERROR;
}
}
+#endif

if (cf->args->nelts >= 3) {
name = value[2];
diff -NaurBpwd nginx-1.3.11_a/src/http/ngx_http_core_module.c nginx-1.3.11_b/src/http/ngx_http_core_module.c
--- nginx-1.3.11_a/src/http/ngx_http_core_module.c 2012-12-18 22:39:39.000000000 +0400
+++ nginx-1.3.11_b/src/http/ngx_http_core_module.c 2013-01-11 01:20:34.872954899 +0400
@@ -1459,6 +1459,9 @@ ngx_http_update_location_config(ngx_http
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 27f082e..9950f19 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1459,6 +1459,9 @@ ngx_http_update_location_config(ngx_http_request_t *r)

if (r == r->main) {
r->connection->log->file = clcf->error_log->file;
Expand All @@ -587,7 +591,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/http/ngx_http_core_module.c nginx-1.3.11_b/src

if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
r->connection->log->log_level = clcf->error_log->log_level;
@@ -4813,6 +4816,15 @@ ngx_http_core_error_log(ngx_conf_t *cf,
@@ -4813,6 +4816,15 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)

ngx_str_t *value, name;

Expand All @@ -603,7 +607,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/http/ngx_http_core_module.c nginx-1.3.11_b/src
if (clcf->error_log) {
return "is duplicate";
}
@@ -4822,6 +4834,36 @@ ngx_http_core_error_log(ngx_conf_t *cf,
@@ -4822,6 +4834,36 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
if (ngx_strcmp(value[1].data, "stderr") == 0) {
ngx_str_null(&name);

Expand Down Expand Up @@ -640,7 +644,7 @@ diff -NaurBpwd nginx-1.3.11_a/src/http/ngx_http_core_module.c nginx-1.3.11_b/src
} else {
name = value[1];
}
@@ -4831,6 +4873,17 @@ ngx_http_core_error_log(ngx_conf_t *cf,
@@ -4831,6 +4873,17 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_ERROR;
}

Expand All @@ -658,9 +662,10 @@ diff -NaurBpwd nginx-1.3.11_a/src/http/ngx_http_core_module.c nginx-1.3.11_b/src
if (cf->args->nelts == 2) {
clcf->error_log->log_level = NGX_LOG_ERR;
return NGX_CONF_OK;
diff -NaurBpwd nginx-1.3.11_a/src/http/ngx_http_request.c nginx-1.3.11_b/src/http/ngx_http_request.c
--- nginx-1.3.11_a/src/http/ngx_http_request.c 2012-11-21 05:08:11.000000000 +0400
+++ nginx-1.3.11_b/src/http/ngx_http_request.c 2013-01-11 01:20:34.872954899 +0400
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index e94e7fc..6eb2d11 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -441,6 +441,9 @@ ngx_http_init_request(ngx_event_t *rev)

clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
Expand Down

0 comments on commit 91e1e3f

Please sign in to comment.