An -1 returned by ubus_msg_writev() will be interpreted as
UINT_MAX during a check to see how much data had could be
written on the socket.
Because sizeof() will return size_t it will promote the
comparsion to unsigned
Signed-off-by: Mihai Richard <mihairichard@live.com>
if (!cl->tx_queue[cl->txq_cur]) {
written = ubus_msg_writev(cl->sock.fd, ub, 0);
- if (written >= ub->len + sizeof(ub->hdr))
- goto out;
if (written < 0)
written = 0;
+ if (written >= ub->len + sizeof(ub->hdr))
+ goto out;
+
cl->txq_ofs = written;
/* get an event once we can write to the socket again */