Browse code

core: proper return code for pvar assignment

- in some case the value of the right expression was returned instead of
proper >=0 for success cases
- reported by Juha Heinannen

Daniel-Constantin Mierla authored on 21/02/2011 22:15:29
Showing 1 changed files
... ...
@@ -290,7 +290,7 @@ inline static int lval_pvar_assign(struct run_act_ctx* h, struct sip_msg* msg,
290 290
 														    break in expr*/
291 291
 			} else
292 292
 				pval.ri=0;
293
-			ret=pval.ri;
293
+			ret=!(!pval.ri);
294 294
 			break;
295 295
 		case RV_BEXPR: /* logic/boolean expr. */
296 296
 			pval.flags=PV_TYPE_INT|PV_VAL_INT;
... ...
@@ -301,7 +301,7 @@ inline static int lval_pvar_assign(struct run_act_ctx* h, struct sip_msg* msg,
301 301
 				WARN("error in expression\n");
302 302
 				pval.ri=0; /* expr. is treated as false */
303 303
 			}
304
-			ret=pval.ri;
304
+			ret=!(!pval.ri);
305 305
 			break;
306 306
 		case RV_SEL:
307 307
 			pval.flags=PV_VAL_STR;
... ...
@@ -315,7 +315,7 @@ inline static int lval_pvar_assign(struct run_act_ctx* h, struct sip_msg* msg,
315 315
 					break;
316 316
 				}
317 317
 			}
318
-			ret=(pval.rs.len)>0;
318
+			ret=(pval.rs.len>0);
319 319
 			break;
320 320
 		case RV_AVP:
321 321
 				r_avp = search_avp_by_index(rv->v.avps.type, rv->v.avps.name,