Closed maage closed 10 years ago
Found this with this script. I run it at directory where I have git trees of some nginx modules. Find function, parse start and end, check returns and later check CONF_ERR
for a in *;do (cd "$a";\
git grep -A 20 -P 'create_(loc|srv|main)_conf\(n'|\
sed 's,^,'"$a"','|\
perl -e 'while(<>){if(/c:ngx/){$in=1};if($in){print};if(/c-\}/){$in=0;next}}'|\
grep return|grep -v 'return NULL;');done|\
grep CONF_ERR|less
@maage Patch applied. Thanks! I've adapted your static analyzing script to my ngx-releng
script I've been using daily:
https://github.com/openresty/nginx-devel-utils/commit/e93b8bd6
All create_(main|srv|loc|*)_conf methods must return NULL on error, not NGX_CONF_ERROR.
See nginx revision:
changeset: 2912:c7d57b539248 user: Igor Sysoev igor@sysoev.ru date: Tue Jun 02 16:09:44 2009 +0000 summary: return NULL instead of NGX_CONF_ERROR on a create conf failure
And also see ngx_http_core_server at src/http/ngx_http_core_module.c around 2985 and 2996. If value is not NULL, conf is accepted and causes errors later.