# HG changeset patch # User Igor Sysoev # Date 1240949163 0 # Node ID 9b107cdf53f60be37c6e0354233f53ddcd5c6339 # Parent 4d62ef39f08bdfa7c1eeee674008d462cd7893c9 *) do not show line number for -g option *) reset configuration file after -g option has been parsed diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c --- 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 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);