If using satip then we would frequently fail to read the data and
then disconnect with errno 0.
So, we now make the FreeBSD socket read consistent with the Linux
version and return EIO on non-error.
if (err)
return -err;
#ifdef PLATFORM_FREEBSD
- if (recv(fd, NULL, 0, MSG_PEEK | MSG_DONTWAIT) < 0)
+ err = recv(fd, NULL, 0, MSG_PEEK | MSG_DONTWAIT);
+ if (err < 0)
return -errno;
+ else if (err == 0)
+ return -EIO;
#else
if (recv(fd, NULL, 0, MSG_PEEK | MSG_DONTWAIT) == 0)
return -EIO;