Gitweb:
http://git.exim.org/exim.git/commitdiff/972af88e604546ee2ab1f817b8a098056065dd78
Commit: 972af88e604546ee2ab1f817b8a098056065dd78
Parent: 791c21c8150041dc7cfa5302961485d942016053
Author: Sebastian Wiedenroth <wiedi@???>
AuthorDate: Tue Sep 2 12:41:30 2014 +0200
Committer: Sebastian Wiedenroth <wiedi@???>
CommitDate: Tue Sep 2 12:41:30 2014 +0200
redis lookup returns false for things that should be true
If redis returns an integer the lookup code currently checks if the value is 1 and returns false for all other values.
This is problematic if you want to use redis commands that return counts (ZCARD etc.) because you can't check for "does not exist" or "exists at least once". (It will be 0->false, 1->true, 2 or more-> false again)
This commit changes the code to handle integer values like C: 0 is false and everything else is true.
For the simple 0 and 1 values nothing changes to existing queries so this diff is backwards compatible.
For queries that return other values exim now gets the bool that would be expected.
---
src/src/lookups/redis.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/src/lookups/redis.c b/src/src/lookups/redis.c
index 87cc9fd..ac4d0ec 100644
--- a/src/src/lookups/redis.c
+++ b/src/src/lookups/redis.c
@@ -211,7 +211,7 @@ perform_redis_search(uschar *command, uschar *server, uschar **resultptr,
break;
case REDIS_REPLY_INTEGER:
- ttmp = (redis_reply->integer == 1) ? US"true" : US"false";
+ ttmp = (redis_reply->integer != 0) ? US"true" : US"false";
result = string_cat(result, &ssize, &offset, US ttmp, Ustrlen(ttmp));
break;
case REDIS_REPLY_STRING: