瀏覽代碼

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 <[email protected]>
Andrei Pelinescu-Onciul 16 年之前
父節點
當前提交
f8a33b3290
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      rvalue.c

+ 4 - 4
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;