From 3895c923a3a959da05080831b8146c09ed143b00 Mon Sep 17 00:00:00 2001 From: "E.Smith" <31170571+azlm8t@users.noreply.github.com> Date: Fri, 17 Aug 2018 23:05:40 +0100 Subject: [PATCH] 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. --- src/tcp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tcp.c b/src/tcp.c index 5349784a4..d15b4381f 100644 --- 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; -- 2.47.2