diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2021-02-03 11:27:52 +0100 |
---|---|---|
committer | Alexander Couzens <lynxis@fe80.eu> | 2021-02-03 14:37:54 +0100 |
commit | c80a8749321640f5e046d984f0fac46e390ad4e2 (patch) | |
tree | 7b977cd3e121a91f4b488e03b5e01120c0c9056c /src/gb/gprs_ns2_udp.c | |
parent | d3e31102fb072e61df0c5eb29aca06137e94183b (diff) |
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
Diffstat (limited to 'src/gb/gprs_ns2_udp.c')
-rw-r--r-- | src/gb/gprs_ns2_udp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c index 9277f9aa..e07f6d43 100644 --- a/src/gb/gprs_ns2_udp.c +++ b/src/gb/gprs_ns2_udp.c @@ -303,8 +303,8 @@ struct gprs_ns2_vc_bind *gprs_ns2_ip_bind_by_sockaddr(struct gprs_ns2_inst *nsi, * \param[in] nsi NS Instance in which to create the NSVC * \param[in] local the local address to bind to * \param[in] dscp the DSCP/TOS bits used for transmitted data - * \param[out] result if set, returns the bind object - * \return 0 on success; negative in case of error */ + * \param[out] result pointer to the created bind or if a bind with the name exists return the bind. + * \return 0 on success; negative on error. -EALREADY returned in case a bind with the name exists */ int gprs_ns2_ip_bind(struct gprs_ns2_inst *nsi, const char *name, const struct osmo_sockaddr *local, @@ -320,7 +320,8 @@ int gprs_ns2_ip_bind(struct gprs_ns2_inst *nsi, bind = gprs_ns2_ip_bind_by_sockaddr(nsi, local); if (bind) { - *result = bind; + if (result) + *result = bind; return -EBUSY; } |