TeslaGov/ngx-http-auth-jwt-module

Error compile in Ubuntu 22.04

mnimz opened this issue · 2 comments

mnimz commented

Hello there,

When trying to install nginx 1.22 with ngx-http-auth-jwt-module...

./configure --prefix=/var/www/html --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --add-dynamic-module=../ngx-http-auth-jwt-module --with-http_ssl_module --with-http_image_filter_module=dynamic --modules-path=/etc/nginx/modules --with-http_v2_module --with-stream=dynamic --with-http_addition_module --with-http_mp4_module

make modules

../ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c
../ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c: In function ‘loadAuthKey’:
../ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c:446:2: error: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
446 | fread(conf->_auth_jwt_keyfile.data, 1, keySize, keyFile);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1407: objs/addon/src/ngx_http_auth_jwt_module.o] Error 1

mnimz commented

Fixed:

if( fread(conf->_auth_jwt_keyfile.data, 1, keySize, keyFile))
        {
          conf->_auth_jwt_keyfile.len = (int)keySize;
          fclose(keyFile);

        return NGX_OK;

        } else {

        return NGX_ERROR;

@mnimz if there is a fix required in this repo, can you open a pull request, please?