summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-05-09 04:18:19 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2019-05-09 23:53:12 +0000
commit0f5f76f65149f82b00ffba40794c59add7bedc88 (patch)
tree133dff70dc8ceef1bfde5ca7ef47e6dc9d06f249 /src
parent4c2d32afe60f949eb1e09f0e3dca8f87d89af106 (diff)
trxcon/trx_if.c: use ssize_t for return value of read()
Diffstat (limited to 'src')
-rw-r--r--src/host/trxcon/trx_if.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index e53fab27..35ad3c02 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -440,15 +440,16 @@ static int trx_ctrl_read_cb(struct osmo_fd *ofd, unsigned int what)
{
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 @@ static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what)
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;
}