[PATCH] osmo-hlr[master]: cosmetic: rx_send_auth_info(): decide error cause with switch()

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Nov 22 19:52:09 UTC 2017


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 <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list