فهرست منبع

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

Reported-by: Juha Heinanen  jh tutpro com
Closes: FlySpray#46.
(cherry picked from commit 0581efe06a8fb0ffe15542c343ae7ac0bc20cbbb)
Andrei Pelinescu-Onciul 15 سال پیش
والد
کامیت
4a280caf2a
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      action.c

+ 2 - 2
action.c

@@ -1116,7 +1116,7 @@ match_cleanup:
 			flags=0;
 			flags=0;
 			rve=(struct rval_expr*)a->val[0].u.data;
 			rve=(struct rval_expr*)a->val[0].u.data;
 			ret=1;
 			ret=1;
-			while(!(flags & BREAK_R_F) && 
+			while(!(flags & (BREAK_R_F|RETURN_R_F|EXIT_R_F)) &&
 					(rval_expr_eval_int(h, msg, &v, rve) == 0) && v){
 					(rval_expr_eval_int(h, msg, &v, rve) == 0) && v){
 				i++;
 				i++;
 				if (unlikely(i > cfg_get(core, core_cfg, max_while_loops))){
 				if (unlikely(i > cfg_get(core, core_cfg, max_while_loops))){
@@ -1131,7 +1131,7 @@ match_cleanup:
 					ret=run_actions(h, (struct action*)a->val[1].u.data, msg);
 					ret=run_actions(h, (struct action*)a->val[1].u.data, msg);
 					flags|=h->run_flags;
 					flags|=h->run_flags;
 					h->run_flags &= ~BREAK_R_F; /* catch breaks, but let
 					h->run_flags &= ~BREAK_R_F; /* catch breaks, but let
-												   returns passthrough */
+												   returns pass-through */
 				}
 				}
 			}
 			}
 			break;
 			break;