]> 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:31 +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 5349784a48b258f19913d22a91d498125a48d0e7..d15b4381ff4b03453da50f3a838dda83cd47aa64 100644 (file)
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -454,8 +454,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;