]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
FreeBSD: Fix recv problem if no data received.
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Fri, 17 Aug 2018 22:05:40 +0000 (23:05 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 3 Sep 2018 13:45:41 +0000 (15:45 +0200)
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.

src/tcp.c

index c3a5d2385c7ec1544884872a5b52277a9f2c6b2b..11641c9705abde6e9f3883dad671992cb3f39a19 100644 (file)
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -414,8 +414,11 @@ tcp_socket_dead(int fd)
   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;