}
}
-static int ubus_msg_writev(int fd, struct ubus_msg_buf *ub, int offset)
+static ssize_t ubus_msg_writev(int fd, struct ubus_msg_buf *ub, size_t offset)
{
static struct iovec iov[2];
static struct {
.msg_controllen = sizeof(fd_buf),
};
struct ubus_msghdr hdr;
- int ret;
+ ssize_t ret;
fd_buf.fd = ub->fd;
if (ub->fd < 0 || offset) {
/* takes the msgbuf reference */
void ubus_msg_send(struct ubus_client *cl, struct ubus_msg_buf *ub)
{
- int written;
+ ssize_t written;
if (ub->hdr.type != UBUS_MSG_MONITOR)
ubusd_monitor_message(cl, ub, true);
if (written < 0)
written = 0;
- if (written >= ub->len + sizeof(ub->hdr))
+ if (written >= (ssize_t) (ub->len + sizeof(ub->hdr)))
return;
cl->txq_ofs = written;
/* first try to tx more pending data */
while ((ub = ubus_msg_head(cl))) {
- int written;
+ ssize_t written;
written = ubus_msg_writev(sock->fd, ub, cl->txq_ofs);
if (written < 0) {
uloop_fd_add(sock, ULOOP_READ | ULOOP_EDGE_TRIGGER);
retry:
- if (!sock->eof && cl->pending_msg_offset < sizeof(cl->hdrbuf)) {
+ if (!sock->eof && cl->pending_msg_offset < (int) sizeof(cl->hdrbuf)) {
int offset = cl->pending_msg_offset;
int bytes;
cl->pending_msg_fd = fd_buf.fd;
cl->pending_msg_offset += bytes;
- if (cl->pending_msg_offset < sizeof(cl->hdrbuf))
+ if (cl->pending_msg_offset < (int) sizeof(cl->hdrbuf))
goto out;
if (blob_pad_len(&cl->hdrbuf.data) > UBUS_MAX_MSGLEN)