Welcome! Log In Create A New Profile

Advanced

Re: Custom Module Directive is Duplicate? Error in conf?

Maxim Dounin
October 23, 2015 11:14AM
Hello!

On Fri, Oct 23, 2015 at 10:01:34AM -0400, de_nginx_noob wrote:

> After compiling a test module that sets a variable equal to "test
> successful", I get a "directive is duplicate in (path to conf file)"

[...]

> conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_netacuity_conf_t));
> if(conf == NULL) {
> return NULL;
> }
> conf->featureCode = NGX_CONF_UNSET_UINT;

Note: featureCode is initialized to NGX_CONF_UNSET_UINT, while
it's defined as ngx_int_t.

The NGX_CONF_UNSET_UINT macro is (ngx_uint_t) -1, that is, it's
maximum value representable in the ngx_uint_t type. Assigning it
to an ngx_int_t variable will result in integer overflow and the
behaviour is undefined. Depending on your C compiler and various
other factors this may or may not work (or may wipe your hard
disk).

Correct macro to use here is NGX_CONF_UNSET.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Custom Module Directive is Duplicate? Error in conf?

de_nginx_noob October 23, 2015 10:01AM

Re: Custom Module Directive is Duplicate? Error in conf?

de_nginx_noob October 23, 2015 10:34AM

Re: Custom Module Directive is Duplicate? Error in conf?

Maxim Dounin October 23, 2015 11:14AM

Re: Custom Module Directive is Duplicate? Error in conf?

de_nginx_noob November 02, 2015 10:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 140
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready