[trivial PATCH 22/22] [rlm_sqlcounter.c] eliminate build warnings

Wang Tinggong wangtinggong at gmail.com
Mon Feb 1 18:33:01 CET 2010


Signed-off-by: Wang Tinggong <wangtinggong at gmail.com>
---
 src/modules/rlm_sqlcounter/rlm_sqlcounter.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c
index 63c3b43..a48f1c5 100644
--- a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c
+++ b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c
@@ -678,7 +678,7 @@ static int sqlcounter_authorize(void *instance, REQUEST *request)
 	 * Check if check item > counter
 	 */
 	if (check_vp->vp_integer > counter) {
-		unsigned int res = check_vp->lvalue - counter;
+		int res = check_vp->lvalue - counter;
 
 		DEBUG2("rlm_sqlcounter: Check item is greater than query result");
 		/*
@@ -705,7 +705,7 @@ static int sqlcounter_authorize(void *instance, REQUEST *request)
 		}
 
 		if ((reply_item = pairfind(request->reply->vps, data->reply_attr)) != NULL) {
-			if (reply_item->vp_integer > res)
+			if (res<0 || reply_item->vp_integer > (unsigned int)res)
 				reply_item->vp_integer = res;
 		} else {
 			reply_item = radius_paircreate(request,
-- 
1.6.0.6



More information about the Freeradius-Devel mailing list