aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libdvbv5
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-08-09 15:40:53 (GMT)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-08-29 17:58:34 (GMT)
commitd58543c21c2493ec4f74b1a54aaaf348f5eb3097 (patch)
tree171a91324d7855bda65713aefaa6fab136882d0d /lib/libdvbv5
parent0b16c25a3d0d886156d1cecc39e8f717aeee44d8 (diff)
libdvbv5: better handle overflow errors
There are some issues with handling overflow errors after the addition of remote access. Address them. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'lib/libdvbv5')
-rw-r--r--lib/libdvbv5/dvb-dev-local.c3
-rw-r--r--lib/libdvbv5/dvb-dev-remote.c11
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/libdvbv5/dvb-dev-local.c b/lib/libdvbv5/dvb-dev-local.c
index f514794..bf69fd6 100644
--- a/lib/libdvbv5/dvb-dev-local.c
+++ b/lib/libdvbv5/dvb-dev-local.c
@@ -558,7 +558,8 @@ static ssize_t dvb_local_read(struct dvb_open_descriptor *open_dev,
ret = read(fd, buf, count);
if (ret == -1) {
- dvb_perror("read()");
+ if (errno != EOVERFLOW)
+ dvb_perror("read()");
return -errno;
}
diff --git a/lib/libdvbv5/dvb-dev-remote.c b/lib/libdvbv5/dvb-dev-remote.c
index b1d9139..c4036c4 100644
--- a/lib/libdvbv5/dvb-dev-remote.c
+++ b/lib/libdvbv5/dvb-dev-remote.c
@@ -273,7 +273,7 @@ static struct queued_msg *send_fmt(struct dvb_device_priv *dvb, int fd,
pthread_mutex_lock(&msg->lock);
i32 = htobe32(p - buf);
- ret = write(fd, (void *)&i32, 4);
+ ret = send(fd, (void *)&i32, 4, MSG_MORE);
if (ret != 4) {
err = 1;
} else {
@@ -363,7 +363,7 @@ static struct queued_msg *send_buf(struct dvb_device_priv *dvb, int fd,
p += in_size;
i32 = htobe32(p - buf);
- ret = write(fd, (void *)&i32, 4);
+ ret = send(fd, (void *)&i32, 4, MSG_MORE);
if (ret != 4) {
err = 1;
} else {
@@ -1514,7 +1514,7 @@ int dvb_dev_remote_init(struct dvb_device *d, char *server, int port)
struct dvb_v5_fe_parms_priv *parms = (void *)dvb->d.fe_parms;
struct dvb_dev_remote_priv *priv;
struct dvb_dev_ops *ops = &dvb->ops;
- int fd, ret;
+ int fd, ret, bufsize;
/* Call an implementation-specific free method, if defined */
if (ops->free)
@@ -1552,6 +1552,11 @@ int dvb_dev_remote_init(struct dvb_device *d, char *server, int port)
return -1;
}
+ /* Set large buffer for read() to work better */
+ bufsize = REMOTE_BUF_SIZE;
+ setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
+ (void *)&bufsize, (int)sizeof(bufsize));
+
/* Start receiving messsages from the server */
pthread_mutex_init(&priv->lock_io, NULL);
ret = pthread_create(&priv->recv_id, NULL, receive_data, dvb);

Privacy Policy