nginx-0.0.3-2004-04-18-23:06:02 import
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 766257c..3c5f789 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -140,11 +140,19 @@
cycle = ngx_init_cycle(&init_cycle);
if (cycle == NULL) {
+ if (ngx_test_config) {
+ ngx_log_error(NGX_LOG_EMERG, log, 0,
+ "the configuration file %s test failed",
+ init_cycle.conf_file.data);
+ }
+
return 1;
}
if (ngx_test_config) {
- ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "config syntax is ok");
+ ngx_log_error(NGX_LOG_INFO, log, 0,
+ "the configuration file %s was tested successfully",
+ init_cycle.conf_file.data);
return 0;
}
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index 94414ae..bde3171 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -138,6 +138,12 @@
return NULL;
}
+ if (ngx_test_config) {
+ ngx_log_error(NGX_LOG_INFO, log, 0,
+ "the configuration file %s syntax is ok",
+ cycle->conf_file.data);
+ }
+
for (i = 0; ngx_modules[i]; i++) {
if (ngx_modules[i]->type != NGX_CORE_MODULE) {
@@ -274,10 +280,12 @@
#if !(WIN32)
- if (dup2(cycle->log->file->fd, STDERR_FILENO) == NGX_ERROR) {
- ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
- "dup2(STDERR) failed");
- failed = 1;
+ if (!failed && !ngx_test_config) {
+ if (dup2(cycle->log->file->fd, STDERR_FILENO) == NGX_ERROR) {
+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
+ "dup2(STDERR) failed");
+ failed = 1;
+ }
}
#endif
@@ -299,6 +307,11 @@
}
}
+ if (ngx_test_config) {
+ ngx_destroy_pool(pool);
+ return NULL;
+ }
+
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {
if (ls[i].new && ls[i].fd == -1) {
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index 285bd83..94e4104 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -20,7 +20,7 @@
ngx_chain_t *cl, *out, **last_out;
/*
- * the short path for the case when the chain ctx->in is empty
+ * the short path for the case when the ctx->in chain is empty
* and the incoming chain is empty too or it has the single hunk
* that does not require the copy
*/
@@ -54,9 +54,14 @@
while (ctx->in) {
+ /*
+ * cycle while there are the ctx->in hunks
+ * or there are the free output hunks to copy in
+ */
+
if (!ngx_output_chain_need_to_copy(ctx, ctx->in->hunk)) {
- /* move the chain link to the chain out */
+ /* move the chain link to the output chain */
cl = ctx->in;
ctx->in = cl->next;
@@ -133,7 +138,7 @@
return rc;
}
- /* delete the completed hunk from the chain ctx->in */
+ /* delete the completed hunk from the ctx->in chain */
if (ngx_hunk_size(ctx->in->hunk) == 0) {
ctx->in = ctx->in->next;
@@ -157,6 +162,10 @@
ngx_chain_update_chains(&ctx->free, &ctx->busy, &out, ctx->tag);
last_out = &out;
+
+ if (last == NGX_ERROR) {
+ return last;
+ }
}
}