From: E.Smith <31170571+azlm8t@users.noreply.github.com> Date: Fri, 17 Aug 2018 22:05:40 +0000 (+0100) Subject: FreeBSD: Fix recv problem if no data received. X-Git-Tag: v4.2.7~54 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43fbffd304a784c74af5c39fe93baf43aac63926;p=thirdparty%2Ftvheadend.git FreeBSD: Fix recv problem if no data received. 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. --- diff --git a/src/tcp.c b/src/tcp.c index c3a5d2385..11641c970 100644 --- 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;