libubus: fix error handling during close after partially receiving a message
authorFelix Fietkau <nbd@openwrt.org>
Wed, 9 Dec 2015 17:26:43 +0000 (18:26 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 9 Dec 2015 17:26:43 +0000 (18:26 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
libubus-io.c

index e6d4236..b9b3128 100644 (file)
@@ -293,7 +293,8 @@ static bool get_next_msg(struct ubus_context *ctx, int *recv_fd)
 
        iov.iov_base = (char *)ctx->msgbuf.data + sizeof(hdrbuf.data);
        iov.iov_len = blob_len(ctx->msgbuf.data);
-       if (iov.iov_len > 0 && !recv_retry(ctx->sock.fd, &iov, true, NULL))
+       if (iov.iov_len > 0 &&
+           recv_retry(ctx->sock.fd, &iov, true, NULL) <= 0)
                return false;
 
        return true;