[sr-dev] git:master:8b1458e9: kamctl: shift only when expecting more parameters for rpc command

Daniel-Constantin Mierla miconda at gmail.com
Wed Feb 20 12:15:46 CET 2019


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-02-20T11:30:26+01:00

kamctl: shift only when expecting more parameters for rpc command

---

Modified: utils/kamctl/kamctl.rpcfifo

---

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

---

diff --git a/utils/kamctl/kamctl.rpcfifo b/utils/kamctl/kamctl.rpcfifo
index 881a8bdf53..0f8f171f48 100644
--- a/utils/kamctl/kamctl.rpcfifo
+++ b/utils/kamctl/kamctl.rpcfifo
@@ -106,13 +106,13 @@ rpc_cmd()
 		CMD="${CMD}, \"params\": [${RPCVAL}"
 		RPCPARAMS="yes"
 	fi
-	shift
-	while [ -n "$1" ] ; do
-		rpcparamval "${1}"
-		CMD="${CMD}, ${RPCVAL}"
-		shift
-	done
 	if [ "$RPCPARAMS" = "yes" ]; then
+		shift
+		while [ -n "$1" ] ; do
+			rpcparamval "${1}"
+			CMD="${CMD}, ${RPCVAL}"
+			shift
+		done
 		CMD="${CMD}]"
 	fi
 	CMD="${CMD}, \"reply_name\": \"${name}\", \"id\": $$}\n"




More information about the sr-dev mailing list