Open
Description
Hi @dctrwatson,
my compiler is configured by default (Debian Squeeze) to treat warnings as errors. Therefore I get the following error:
cc1: warnings being treated as errors
../nginx-memcached-hash-pass/ngx_http_memcached_hash_module.c: In function 'ngx_http_memcached_hash_filter':
../nginx-memcached-hash-pass/ngx_http_memcached_hash_module.c:459: error: comparison between signed and unsigned integer expressions
make[1]: *** [objs/addon/nginx-memcached-hash-pass/ngx_http_memcached_hash_module.o] Error 1
make[1]: Leaving directory `/vagrant/nginx/nginx-1.2.3'
make: *** [build] Error 2
I did a simple cast to fix it for me:
diff --git a/ngx_http_memcached_hash_module.c b/ngx_http_memcached_hash_module.c
index a135bf2..d863580 100644
--- a/ngx_http_memcached_hash_module.c
+++ b/ngx_http_memcached_hash_module.c
@@ -456,7 +456,7 @@ ngx_http_memcached_hash_filter(void *data, ssize_t bytes)
u = ctx->request->upstream;
b = &u->buffer;
- if (u->length == ctx->rest) {
+ if ((size_t)u->length == ctx->rest) {
if (ngx_strncmp(b->last,
ngx_http_memcached_hash_end + NGX_HTTP_MEMCACHED_HASH_END - ctx->rest,
I am not a C dev, but I guess the better way would be to initialize "length" and "rest" as unsigned from the beginning. However I don't know if you actually need "signed".
Thank you!
Best, Alex
Metadata
Metadata
Assignees
Labels
No labels