Nginx compile warning - ngx_http_sticky_misc.c: ngx_http_sticky_misc_set_cookie: expires_len’ may be used uninitialized

Issue #5 resolved
Kok Tean Lim created an issue

Compile Error / Warning:

cc1: warnings being treated as errors modules/nginx-sticky-module-ng-45973be2b64e//ngx_http_sticky_misc.c: In function ‘ngx_http_sticky_misc_set_cookie’: modules/nginx-sticky-module-ng-45973be2b64e//ngx_http_sticky_misc.c:39: error: ‘expires_len’ may be used uninitialized in this function make[1]: [objs/addon/nginx-sticky-module-ng-45973be2b64e/ngx_http_sticky_misc.o] Error 1 make[1]: Leaving directory `/root/Downloads/nginx-1.4.7' make: [build] Error 2

Suggested Patch

vi modules/nginx-sticky-module-ng/ngx_http_sticky_misc.c

ngx_int_t ngx_http_sticky_misc_set_cookie(ngx_http_request_t r, ngx_str_t name, ngx_str_t value, ngx_str_t domain, ngx_str_t path, time_t expires, unsigned secure, unsigned httponly) { u_char cookie, p; size_t len; ngx_table_elt_t set_cookie, elt; ngx_str_t remove; ngx_list_part_t part; ngx_uint_t i; char expires_str[80]; int expires_len=0;

Comments (5)

  1. S. Goodman repo owner
    • changed status to open

    we had a similar issue on SLES and worked around it like this:

    /* - bugfix for compiling on sles11 - needs gcc4.6 or later*/
    #pragma GCC diagnostic ignored "-Wuninitialized" 
    

    i test your changes and report later

  2. Log in to comment