From b9c9ee1ca79765b944269c4ad6a4bb172fc23851 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Fri, 9 Sep 2022 17:17:36 -0300 Subject: [PATCH] Fix read problem in linux errno is only set if read returns < 0 and won't be set to 0 if read succeeds, so we were bailing here frequently on successful reads (whenever errno happened to be non-0). --- llarp/vpn/linux.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llarp/vpn/linux.hpp b/llarp/vpn/linux.hpp index 5fc06d674..9dcf9b761 100644 --- a/llarp/vpn/linux.hpp +++ b/llarp/vpn/linux.hpp @@ -110,7 +110,7 @@ namespace llarp::vpn std::vector pkt; pkt.resize(net::IPPacket::MaxSize); const auto sz = read(m_fd, pkt.data(), pkt.capacity()); - if (errno) + if (sz < 0) { if (errno == EAGAIN or errno == EWOULDBLOCK) {