Change in libosmocore[master]: ns2: vty: fix behavior of vtyvc_by_nsei when vtyvc isn't found

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/.

laforge gerrit-no-reply at lists.osmocom.org
Fri Sep 25 09:45:27 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20264 )

Change subject: ns2: vty: fix behavior of vtyvc_by_nsei when vtyvc isn't found
......................................................................

ns2: vty: fix behavior of vtyvc_by_nsei when vtyvc isn't found

Fixes the parsing of persistent nsvcs.

Change-Id: I297409f557f17df680ac76018b4202eb99713021
---
M src/gb/gprs_ns2_vty.c
1 file changed, 8 insertions(+), 7 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  daniel: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index f204ff1..ab869c3 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -138,20 +138,21 @@
 
 static struct ns2_vty_vc *vtyvc_by_nsei(uint16_t nsei, bool alloc_missing) {
 	struct ns2_vty_vc *vtyvc;
+
 	llist_for_each_entry(vtyvc, &priv.vtyvc, list) {
 		if (vtyvc->nsei == nsei)
 			return vtyvc;
 	}
 
-	if (alloc_missing) {
-		vtyvc = vtyvc_alloc(nsei);
-		if (!vtyvc)
-			return vtyvc;
+	if (!alloc_missing)
+		return NULL;
 
-		vtyvc->nsei = nsei;
-	}
+	vtyvc = vtyvc_alloc(nsei);
+	if (!vtyvc)
+		return vtyvc;
 
-	return NULL;
+	vtyvc->nsei = nsei;
+	return vtyvc;
 }
 
 static int config_write_ns(struct vty *vty)

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I297409f557f17df680ac76018b4202eb99713021
Gerrit-Change-Number: 20264
Gerrit-PatchSet: 5
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200925/79908464/attachment.htm>


More information about the gerrit-log mailing list