comparison src/http/modules/ngx_http_log_module.c @ 5719:7f425d67f91a

Access log: fix default value, broken by cb308813b453. log->filter ("if" parameter) was uninitialized when the default value was being used, which would lead to a crash (SIGSEGV) when access_log directive wasn't specified in the configuration. Zero-fill the whole structure instead of zeroing fields one-by-one in order to prevent similar issues in the future. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
author Piotr Sikora <piotr@cloudflare.com>
date Tue, 03 Jun 2014 10:53:48 -0700
parents 777202558122
children b1f8285297a7
comparison
equal deleted inserted replaced
5718:c46657e391a3 5719:7f425d67f91a
1107 log = ngx_array_push(conf->logs); 1107 log = ngx_array_push(conf->logs);
1108 if (log == NULL) { 1108 if (log == NULL) {
1109 return NGX_CONF_ERROR; 1109 return NGX_CONF_ERROR;
1110 } 1110 }
1111 1111
1112 ngx_memzero(log, sizeof(ngx_http_log_t));
1113
1112 log->file = ngx_conf_open_file(cf->cycle, &ngx_http_access_log); 1114 log->file = ngx_conf_open_file(cf->cycle, &ngx_http_access_log);
1113 if (log->file == NULL) { 1115 if (log->file == NULL) {
1114 return NGX_CONF_ERROR; 1116 return NGX_CONF_ERROR;
1115 } 1117 }
1116
1117 log->script = NULL;
1118 log->disk_full_time = 0;
1119 log->error_log_time = 0;
1120 log->syslog_peer = NULL;
1121 1118
1122 lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module); 1119 lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
1123 fmt = lmcf->formats.elts; 1120 fmt = lmcf->formats.elts;
1124 1121
1125 /* the default "combined" format */ 1122 /* the default "combined" format */