aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns2_fr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gb/gprs_ns2_fr.c')
-rw-r--r--src/gb/gprs_ns2_fr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index fc6a5c4d..f1a55765 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -721,8 +721,8 @@ err:
* \param[in] netif Network interface to bind to
* \param[in] fr_network
* \param[in] fr_role
- * \param[out] result pointer to created bind
- * \return 0 on success; negative on 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_fr_bind(struct gprs_ns2_inst *nsi,
const char *name,
const char *netif,
@@ -738,8 +738,12 @@ int gprs_ns2_fr_bind(struct gprs_ns2_inst *nsi,
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)