openresty / headers-more-nginx-module

Set, add, and clear arbitrary output headers in NGINX http servers
1.65k stars 220 forks source link

redundant return code check #164

Open leeriorio opened 1 week ago

leeriorio commented 1 week ago

In result of static analyse of nginx sources (including headers-more-nginx-module) with Svace static analyzer I found minor error of cathegory "REDUNDANT_COMPARISON.ALWAYS_FALSE" in ngx_http_headers_more_filter_module.c.

https://github.com/openresty/headers-more-nginx-module/blob/f8f80997f19a41dc4181987544b9f3570cc3d6da/src/ngx_http_headers_more_filter_module.c#L234-L239

calling function ngx_http_headers_more_filter_init returns NGX_OK code only. Is it correct to check it there?

zhuizhuhaomeng commented 3 days ago

Yes, we should check it here in case the ngx_http_headers_more_filter_init() returns other code in the future.