[SR-Dev] git:master: core expr eval: fix script functions failure check

Andrei Pelinescu-Onciul andrei at iptel.org
Mon May 4 10:43:16 CEST 2009


Module: sip-router
Branch: master
Commit: f8a33b329085731db4a00aead676f044cd27b939
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f8a33b329085731db4a00aead676f044cd27b939

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Mon May  4 10:41:07 2009 +0200

core expr eval: fix script functions failure check

script/module functions integer/boolean evaluation did not respect
the module return convention (>0 success, <0 failure).

Reported-by: Daniel-Constantin Mierla <miconda at gmail.com>

---

 rvalue.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/rvalue.c b/rvalue.c
index 897fb4d..f75c6e9 100644
--- a/rvalue.c
+++ b/rvalue.c
@@ -693,8 +693,8 @@ int rval_get_int(struct run_act_ctx* h, struct sip_msg* msg,
 			break;
 		case RV_ACTION_ST:
 			if (rv->v.action)
-				*i=run_actions(h, rv->v.action, msg);
-			else 
+				*i=(run_actions(h, rv->v.action, msg)>0);
+			else
 				*i=0;
 			break;
 		case RV_SEL:
@@ -796,8 +796,8 @@ int rval_get_tmp_str(struct run_act_ctx* h, struct sip_msg* msg,
 			break;
 		case RV_ACTION_ST:
 			if (rv->v.action)
-				i=run_actions(h, rv->v.action, msg);
-			else 
+				i=(run_actions(h, rv->v.action, msg)>0);
+			else
 				i=0;
 			tmpv->s=int2str(i, &tmpv->len);
 			break;




More information about the sr-dev mailing list