Module: kamailio
Branch: master
Commit: d89d643ab144a7a72aebd59c34df011f77dc4e34
URL: 
https://github.com/kamailio/kamailio/commit/d89d643ab144a7a72aebd59c34df011f77dc4e34

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2017-01-21T19:54:31+01:00

core: print cfg line and column inside fix_rval() if resolve select fails

---

Modified: src/core/rvalue.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/d89d643ab144a7a72aebd59c34df011f77dc4e34.diff
Patch: 
https://github.com/kamailio/kamailio/commit/d89d643ab144a7a72aebd59c34df011f77dc4e34.patch

---

diff --git a/src/core/rvalue.c b/src/core/rvalue.c
index 2861207..a38a524 100644
--- a/src/core/rvalue.c
+++ b/src/core/rvalue.c
@@ -2839,7 +2839,7 @@ static int rve_can_optimize_str(struct rval_expr* rve)
                return 0;
        if (rve->op == RVE_RVAL_OP)
                return 0;
-       LM_DBG("left %d, right %d\n", 
+       LM_DBG("left %d, right %d\n",
                        rve->left.rve->op, rve->right.rve?rve->right.rve->op:0);
        if (rve->left.rve->op != RVE_RVAL_OP)
                return 0;
@@ -2848,7 +2848,7 @@ static int rve_can_optimize_str(struct rval_expr* rve)
        if (rve->right.rve){
                if  (rve->right.rve->op != RVE_RVAL_OP)
                        return 0;
-               if ((rve->right.rve->left.rval.type!=RV_STR) && 
+               if ((rve->right.rve->left.rval.type!=RV_STR) &&
                                (rve->right.rve->left.rval.type!=RV_INT))
                        return 0;
        }
@@ -2858,7 +2858,7 @@ static int rve_can_optimize_str(struct rval_expr* rve)
 
 
 
-static int fix_rval(struct rvalue* rv)
+static int fix_rval(struct rvalue* rv, struct rval_expr* rve)
 {
        LM_DBG("RV fixing type %d\n", rv->type);
        switch(rv->type){
@@ -2876,8 +2876,13 @@ static int fix_rval(struct rvalue* rv)
                        return fix_actions(rv->v.action);
                case RV_SEL:
                        if (resolve_select(&rv->v.sel)<0){
-                               ERR("Unable to resolve select\n");
-                               print_select(&rv->v.sel);
+                               if(rve==NULL) {
+                                       ERR("Unable to resolve select\n");
+                               } else {
+                                       ERR("Unable to resolve select in cfg at 
line: %d col: %d\n",
+                                                       rve->fpos.s_line, 
rve->fpos.s_col);
+                               }
+                               err_select(&rv->v.sel);
                        }
                        return 0;
                case RV_AVP:
@@ -3794,7 +3799,7 @@ int fix_rval_expr(void* p)
                        BUG("empty rval expr\n");
                        break;
                case RVE_RVAL_OP:
-                       ret = fix_rval(&rve->left.rval);
+                       ret = fix_rval(&rve->left.rval, rve);
                        if (ret<0) goto error;
                        return ret;
                case RVE_UMINUS_OP: /* unary operators */


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to