[sr-dev] git:master: core: fix return not working inside a while() loop

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Mar 25 22:16:22 CET 2010


Module: sip-router
Branch: master
Commit: 0581efe06a8fb0ffe15542c343ae7ac0bc20cbbb
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0581efe06a8fb0ffe15542c343ae7ac0bc20cbbb

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu Mar 25 22:04:44 2010 +0100

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

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

---

 action.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/action.c b/action.c
index e39b539..ef33814 100644
--- a/action.c
+++ b/action.c
@@ -1134,7 +1134,7 @@ match_cleanup:
 			flags=0;
 			rve=(struct rval_expr*)a->val[0].u.data;
 			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){
 				i++;
 				if (unlikely(i > cfg_get(core, core_cfg, max_while_loops))){
@@ -1149,7 +1149,7 @@ match_cleanup:
 					ret=run_actions(h, (struct action*)a->val[1].u.data, msg);
 					flags|=h->run_flags;
 					h->run_flags &= ~BREAK_R_F; /* catch breaks, but let
-												   returns passthrough */
+												   returns pass-through */
 				}
 			}
 			break;




More information about the sr-dev mailing list