Browse code

core: fix return not working inside a while() loop

Reported-by: Juha Heinanen jh tutpro com
Closes: FlySpray#46.

Andrei Pelinescu-Onciul authored on 25/03/2010 21:04:44
Showing 1 changed files
... ...
@@ -1134,7 +1134,7 @@ match_cleanup:
1134 1134
 			flags=0;
1135 1135
 			rve=(struct rval_expr*)a->val[0].u.data;
1136 1136
 			ret=1;
1137
-			while(!(flags & BREAK_R_F) && 
1137
+			while(!(flags & (BREAK_R_F|RETURN_R_F|EXIT_R_F)) &&
1138 1138
 					(rval_expr_eval_int(h, msg, &v, rve) == 0) && v){
1139 1139
 				i++;
1140 1140
 				if (unlikely(i > cfg_get(core, core_cfg, max_while_loops))){
... ...
@@ -1149,7 +1149,7 @@ match_cleanup:
1149 1149
 					ret=run_actions(h, (struct action*)a->val[1].u.data, msg);
1150 1150
 					flags|=h->run_flags;
1151 1151
 					h->run_flags &= ~BREAK_R_F; /* catch breaks, but let
1152
-												   returns passthrough */
1152
+												   returns pass-through */
1153 1153
 				}
1154 1154
 			}
1155 1155
 			break;