Change in osmo-mgw[master]: vty: fix unreachable code (error msg on trunk alloc fail)

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Fri May 29 19:23:11 UTC 2020


dexter has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/18581 )

Change subject: vty: fix unreachable code (error msg on trunk alloc fail)
......................................................................

vty: fix unreachable code (error msg on trunk alloc fail)

When a trunk is selected that does not exist, a new one is created. In
this case the VTY would print an error message but the function exits
early. The code that would print the error is unreachable.

Change-Id: Ie8c3b083174eb8209df2c06f65db6d7bbfaa87f7
fixes: CID#210637
---
M src/libosmo-mgcp/mgcp_vty.c
1 file changed, 4 insertions(+), 7 deletions(-)

Approvals:
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 6a431e5..bdcb55c 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -813,14 +813,11 @@
 	trunk = mgcp_trunk_num(g_cfg, index);
 	if (!trunk) {
 		trunk = mgcp_trunk_alloc(g_cfg, MGCP_TRUNK_E1, index);
-		if (!trunk)
+		if (!trunk) {
+			vty_out(vty, "%%Unable to allocate trunk %u.%s",
+				index, VTY_NEWLINE);
 			return CMD_WARNING;
-	}
-
-	if (!trunk) {
-		vty_out(vty, "%%Unable to allocate trunk %u.%s",
-			index, VTY_NEWLINE);
-		return CMD_WARNING;
+		}
 	}
 
 	vty->node = TRUNK_NODE;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/18581
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ie8c3b083174eb8209df2c06f65db6d7bbfaa87f7
Gerrit-Change-Number: 18581
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200529/53f012d1/attachment.htm>


More information about the gerrit-log mailing list