Change in osmocom-bb[master]: layer23/sap_interface.c: return rc from osmosap_send_apdu()

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

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Wed Dec 26 20:52:21 UTC 2018


Vadim Yanitskiy has submitted this change and it was merged. ( https://gerrit.osmocom.org/12431 )

Change subject: layer23/sap_interface.c: return rc from osmosap_send_apdu()
......................................................................

layer23/sap_interface.c: return rc from osmosap_send_apdu()

Change-Id: I3965843c4d49e31b1b5156d9ee8439eef6ecaab1
---
M src/host/layer23/src/common/sap_interface.c
1 file changed, 10 insertions(+), 7 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/layer23/src/common/sap_interface.c b/src/host/layer23/src/common/sap_interface.c
index a32c3aa..23b482a 100644
--- a/src/host/layer23/src/common/sap_interface.c
+++ b/src/host/layer23/src/common/sap_interface.c
@@ -474,10 +474,11 @@
 	ms->sap_entity.sap_state = SAP_NOT_CONNECTED;
 }
 
-static void sap_apdu(struct osmocom_ms *ms, uint8_t *data, uint16_t len)
+static int sap_apdu(struct osmocom_ms *ms, uint8_t *data, uint16_t len)
 {
 	struct msgb *msg;
 	struct sap_param params[1];
+	int rc;
 
 	params[0].id = SAP_COMMAND_APDU;
 	params[0].len = len;
@@ -485,16 +486,20 @@
 
 	if(ms->sap_entity.sap_state != SAP_IDLE){
 		LOGP(DSAP, LOGL_ERROR, "Attempting to send APDU request while not being idle.\n");
-		return;
+		return -EIO;
 	}
 
 	msg = sap_create_msg(SAP_TRANSFER_APDU_REQ, 1, params);
 	if(!msg)
-		return;
+		return -ENOMEM;
 
-	osmosap_send(ms, msg);
+	rc = osmosap_send(ms, msg);
+	if (rc)
+		return rc;
 
 	ms->sap_entity.sap_state = SAP_PROCESSING_APDU_REQUEST;
+
+	return 0;
 }
 
 int sap_open(struct osmocom_ms *ms, const char *socket_path)
@@ -538,9 +543,7 @@
 {
 	//LOGP(DSAP, LOGL_ERROR, "Received the following APDU from sim.c: %s\n" ,
 	//     osmo_hexdump(data, length));
-	sap_apdu(ms, data, length);
-
-	return 0;
+	return sap_apdu(ms, data, length);
 }
 
 /* register message handler for messages that are sent from L2->L3 */

-- 
To view, visit https://gerrit.osmocom.org/12431
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I3965843c4d49e31b1b5156d9ee8439eef6ecaab1
Gerrit-Change-Number: 12431
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Kévin Redon <kredon at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181226/5138016d/attachment.htm>


More information about the gerrit-log mailing list