Browse code

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@gmail.com>

Andrei Pelinescu-Onciul authored on 04/05/2009 08:41:07
Showing 1 changed files
... ...
@@ -693,8 +693,8 @@ int rval_get_int(struct run_act_ctx* h, struct sip_msg* msg,
693 693
 			break;
694 694
 		case RV_ACTION_ST:
695 695
 			if (rv->v.action)
696
-				*i=run_actions(h, rv->v.action, msg);
697
-			else 
696
+				*i=(run_actions(h, rv->v.action, msg)>0);
697
+			else
698 698
 				*i=0;
699 699
 			break;
700 700
 		case RV_SEL:
... ...
@@ -796,8 +796,8 @@ int rval_get_tmp_str(struct run_act_ctx* h, struct sip_msg* msg,
796 796
 			break;
797 797
 		case RV_ACTION_ST:
798 798
 			if (rv->v.action)
799
-				i=run_actions(h, rv->v.action, msg);
800
-			else 
799
+				i=(run_actions(h, rv->v.action, msg)>0);
800
+			else
801 801
 				i=0;
802 802
 			tmpv->s=int2str(i, &tmpv->len);
803 803
 			break;