Change in osmocom-bb[master]: trxcon/trx_if.c: use ssize_t for return value of read()

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Thu May 9 21:40:15 UTC 2019


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/13958


Change subject: trxcon/trx_if.c: use ssize_t for return value of read()
......................................................................

trxcon/trx_if.c: use ssize_t for return value of read()

Change-Id: I4a489be6fafcd057c3edc4f3d5f76d645899f884
---
M src/host/trxcon/trx_if.c
1 file changed, 14 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/58/13958/1

diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index e53fab2..35ad3c0 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -440,15 +440,16 @@
 {
 	struct trx_instance *trx = ofd->data;
 	struct trx_ctrl_msg *tcm;
-	int len, resp, rsp_len;
+	int resp, rsp_len;
 	char buf[1500], *p;
+	ssize_t read_len;
 
-	len = read(ofd->fd, buf, sizeof(buf) - 1);
-	if (len <= 0) {
-		LOGP(DTRX, LOGL_ERROR, "read() failed with rc=%d\n", len);
-		return len;
+	read_len = read(ofd->fd, buf, sizeof(buf) - 1);
+	if (read_len <= 0) {
+		LOGP(DTRX, LOGL_ERROR, "read() failed with rc=%zd\n", read_len);
+		return read_len;
 	}
-	buf[len] = '\0';
+	buf[read_len] = '\0';
 
 	if (!!strncmp(buf, "RSP ", 4)) {
 		LOGP(DTRX, LOGL_NOTICE, "Unknown message on CTRL port: %s\n", buf);
@@ -550,17 +551,17 @@
 	int8_t rssi, tn;
 	int16_t toa256;
 	uint32_t fn;
-	int len;
+	ssize_t read_len;
 
-	len = read(ofd->fd, buf, sizeof(buf));
-	if (len <= 0) {
-		LOGP(DTRXD, LOGL_ERROR, "read() failed with rc=%d\n", len);
-		return len;
+	read_len = read(ofd->fd, buf, sizeof(buf));
+	if (read_len <= 0) {
+		LOGP(DTRXD, LOGL_ERROR, "read() failed with rc=%zd\n", read_len);
+		return read_len;
 	}
 
-	if (len != 158) {
+	if (read_len != 158) {
 		LOGP(DTRXD, LOGL_ERROR, "Got data message with invalid "
-			"length '%d'\n", len);
+			"length '%zd'\n", read_len);
 		return -EINVAL;
 	}
 

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a489be6fafcd057c3edc4f3d5f76d645899f884
Gerrit-Change-Number: 13958
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190509/c5b45b3c/attachment.html>


More information about the gerrit-log mailing list