trxcon/trx_if.c: print error message if read() call fails

Change-Id: If3aaa730c306e703d1d430a8920284aa592c999c
This commit is contained in:
Vadim Yanitskiy 2019-05-09 04:14:45 +07:00
parent 2d05901cd4
commit 4c2d32afe6
1 changed files with 6 additions and 2 deletions

View File

@ -444,8 +444,10 @@ static int trx_ctrl_read_cb(struct osmo_fd *ofd, unsigned int what)
char buf[1500], *p;
len = read(ofd->fd, buf, sizeof(buf) - 1);
if (len <= 0)
if (len <= 0) {
LOGP(DTRX, LOGL_ERROR, "read() failed with rc=%d\n", len);
return len;
}
buf[len] = '\0';
if (!!strncmp(buf, "RSP ", 4)) {
@ -551,8 +553,10 @@ static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what)
int len;
len = read(ofd->fd, buf, sizeof(buf));
if (len <= 0)
if (len <= 0) {
LOGP(DTRXD, LOGL_ERROR, "read() failed with rc=%d\n", len);
return len;
}
if (len != 158) {
LOGP(DTRXD, LOGL_ERROR, "Got data message with invalid "