Review at  https://gerrit.osmocom.org/3014

sccp_user.c: add missing error logging

Change-Id: I98e400e297f8fa83037a8e74a936e4ecc137099c
---
M src/sccp_user.c
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/14/3014/1

diff --git a/src/sccp_user.c b/src/sccp_user.c
index 5f89f71..84ea480 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -74,8 +74,14 @@
        if (!pc_valid)
                pc = 0;
 
-       if (sccp_user_find(inst, ssn, pc))
+       scu = sccp_user_find(inst, ssn, pc);
+       if (scu) {
+               LOGP(DLSCCP, LOGL_ERROR,
+                    "Cannot bind user '%s' to SSN=%u PC=%u (pc_valid=%u), this 
SSN and PC"
+                    " is already bound by '%s'\n",
+                    name, ssn, pc, pc_valid, scu->name);
                return NULL;
+       }
 
        LOGP(DLSCCP, LOGL_INFO, "Binding user '%s' to SSN=%u PC=%u 
(pc_valid=%u)\n",
                name, ssn, pc, pc_valid);
@@ -247,8 +253,10 @@
 
        /* allocate + initialize SS7 instance */
        ss7 = osmo_ss7_instance_find_or_create(ctx, 1);
-       if (!ss7)
+       if (!ss7) {
+               LOGP(DLSCCP, LOGL_ERROR, "Failed to find or create SS7 
instance\n");
                return NULL;
+       }
        ss7->cfg.primary_pc = pc;
 
        as_name = talloc_asprintf(ctx, "as-clnt-%s", name);

-- 
To view, visit https://gerrit.osmocom.org/3014
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98e400e297f8fa83037a8e74a936e4ecc137099c
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to