aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_conf_file.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-04-28 20:06:03 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-04-28 20:06:03 +0000
commitca6a9e0fdc594c185141d16f6e47dbbd2a83046e (patch)
tree3edeca3fd377aaab3600ed3437cf6f40ecb047ee /src/core/ngx_conf_file.c
parent9441ffadbe3cd65befb97b0452bf3c27f296866f (diff)
downloadnginx-ca6a9e0fdc594c185141d16f6e47dbbd2a83046e.tar.gz
nginx-ca6a9e0fdc594c185141d16f6e47dbbd2a83046e.zip
*) do not show line number for -g option
*) reset configuration file after -g option has been parsed
Diffstat (limited to 'src/core/ngx_conf_file.c')
-rw-r--r--src/core/ngx_conf_file.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index 7c641e024..2662e5f6e 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -61,6 +61,7 @@ static ngx_uint_t argument_number[] = {
char *
ngx_conf_param(ngx_conf_t *cf)
{
+ char *rv;
ngx_str_t *param;
ngx_buf_t b;
ngx_conf_file_t conf_file;
@@ -82,13 +83,17 @@ ngx_conf_param(ngx_conf_t *cf)
b.temporary = 1;
conf_file.file.fd = NGX_INVALID_FILE;
- conf_file.file.name.data = (u_char *) "command line";
- conf_file.line = 1;
+ conf_file.file.name.data = NULL;
+ conf_file.line = 0;
cf->conf_file = &conf_file;
cf->conf_file->buffer = &b;
- return ngx_conf_parse(cf, NULL);
+ rv = ngx_conf_parse(cf, NULL);
+
+ cf->conf_file = NULL;
+
+ return rv;
}
@@ -973,6 +978,12 @@ ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err,
return;
}
+ if (cf->conf_file->file.fd == NGX_INVALID_FILE) {
+ ngx_log_error(level, cf->log, 0, "%*s in command line",
+ p - errstr, errstr);
+ return;
+ }
+
ngx_log_error(level, cf->log, 0, "%*s in %s:%ui",
p - errstr, errstr,
cf->conf_file->file.name.data, cf->conf_file->line);