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

cosmetic: rx_send_auth_info(): decide error cause with switch()

Prepare for tweaking error handling in a subsequent patch: use switch() instead
of if().

Prepares-for: I90df7b255317df1e5d968e7ce3b9d2c404b98db8
Change-Id: I1f628aa9d62b778951726bebec8cf338444fc897
---
M src/hlr.c
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/75/4975/1

diff --git a/src/hlr.c b/src/hlr.c
index 861597a..ef008f0 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -67,12 +67,16 @@
                        gsup_out.auth_vectors,
                        ARRAY_SIZE(gsup_out.auth_vectors),
                        gsup->rand, gsup->auts);
-       if (rc < 0) {
+       if (rc <= 0) {
                gsup_out.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR;
-               gsup_out.cause = GMM_CAUSE_NET_FAIL;
-       } else if (rc == 0) {
-               gsup_out.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR;
-               gsup_out.cause = GMM_CAUSE_IMSI_UNKNOWN;
+               switch (rc) {
+               case 0:
+                       gsup_out.cause = GMM_CAUSE_IMSI_UNKNOWN;
+                       break;
+               default:
+                       gsup_out.cause = GMM_CAUSE_NET_FAIL;
+                       break;
+               }
        } else {
                gsup_out.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT;
                gsup_out.num_auth_vectors = rc;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f628aa9d62b778951726bebec8cf338444fc897
Gerrit-PatchSet: 1
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <[email protected]>

Reply via email to