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).
This commit is contained in:
Jason Rhinelander 2022-09-09 17:17:36 -03:00
parent 15443568db
commit b9c9ee1ca7
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
1 changed files with 1 additions and 1 deletions

View File

@ -110,7 +110,7 @@ namespace llarp::vpn
std::vector<byte_t> 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)
{