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/.
lynxis lazus gerrit-no-reply at lists.osmocom.orglynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/22644 )
Change subject: gprs_ns2: unify the handling of **result when bind already present.
......................................................................
gprs_ns2: unify the handling of **result when bind already present.
All bind function should work in the same way.
Also fixing a null pointer assignment if no **result is giving.
Change-Id: Idd0c2190d2af39804c18c4786a997079db9a4330
---
M src/gb/gprs_ns2_fr.c
M src/gb/gprs_ns2_frgre.c
M src/gb/gprs_ns2_udp.c
3 files changed, 9 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/22644/1
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index fc6a5c4..3af20b4 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -738,8 +738,12 @@
if (strlen(netif) > IFNAMSIZ)
return -EINVAL;
- if (gprs_ns2_bind_by_name(nsi, name))
+ bind = gprs_ns2_bind_by_name(nsi, name);
+ if (bind) {
+ if (result)
+ *result = bind;
return -EALREADY;
+ }
rc = ns2_bind_alloc(nsi, name, &bind);
if (rc < 0)
diff --git a/src/gb/gprs_ns2_frgre.c b/src/gb/gprs_ns2_frgre.c
index 88ef037..8b40d7b 100644
--- a/src/gb/gprs_ns2_frgre.c
+++ b/src/gb/gprs_ns2_frgre.c
@@ -546,7 +546,8 @@
bind = gprs_ns2_bind_by_name(nsi, name);
if (bind) {
- *result = bind;
+ if (result)
+ *result = bind;
return -EALREADY;
}
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index 9277f9a..9bc63c7 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -320,7 +320,8 @@
bind = gprs_ns2_ip_bind_by_sockaddr(nsi, local);
if (bind) {
- *result = bind;
+ if (result)
+ *result = bind;
return -EBUSY;
}
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22644
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Idd0c2190d2af39804c18c4786a997079db9a4330
Gerrit-Change-Number: 22644
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210203/87165d9d/attachment.htm>