Wrong type used in download_client:socket_recv

Dear support,

In NCS 2.1.2, it looks like download_client.c:socket_recv() is returning an erroneous unsigned type size_t, considering that it can can return either -1 or the result of a call to recv, which returns a signed ssize_t.

In same file, the function download_thread is also inconsistently using a variable len of type size_t to compare against -1.

static size_t socket_recv(struct download_client *dl)
{
...
	return recv(dl->fd, dl->buf + dl->offset, sizeof(dl->buf) - dl->offset, 0);
}

void download_thread(void *client, void *a, void *b)
{
	size_t len;
...
		len = socket_recv(dl);
		if ((len == 0) || (len == -1)) {

Kind regards.

Related