From: Remi Gacogne Date: Thu, 20 Jul 2023 09:17:27 +0000 (+0200) Subject: dnsdist: Add suggestions from code review X-Git-Tag: rec-5.0.0-alpha1~97^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F13012%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Add suggestions from code review --- diff --git a/pdns/dnsdistdist/dnsdist-healthchecks.cc b/pdns/dnsdistdist/dnsdist-healthchecks.cc index d8d73b4e2a..66f421479e 100644 --- a/pdns/dnsdistdist/dnsdist-healthchecks.cc +++ b/pdns/dnsdistdist/dnsdist-healthchecks.cc @@ -190,11 +190,11 @@ static void healthCheckUDPCallback(int descriptor, FDMultiplexer::funcparam_t& p data->d_buffer.resize(512); // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - got = recvfrom(data->d_udpSocket.getHandle(), &data->d_buffer.at(0), data->d_buffer.size(), 0, reinterpret_cast(&from), &fromlen); + got = recvfrom(data->d_udpSocket.getHandle(), data->d_buffer.data(), data->d_buffer.size(), 0, reinterpret_cast(&from), &fromlen); if (got < 0) { int savederrno = errno; if (savederrno == EINTR) { - /* interrupted, let's try again */ + /* interrupted before any data was available, let's try again */ continue; } if (savederrno == EWOULDBLOCK || savederrno == EAGAIN) { @@ -250,7 +250,7 @@ static void healthCheckTCPCallback(int descriptor, FDMultiplexer::funcparam_t& p if (ioState == IOState::Done) { data->d_bufferPos = 0; uint16_t responseSize{0}; - memcpy(&responseSize, &data->d_buffer.at(0), sizeof(responseSize)); + memcpy(&responseSize, data->d_buffer.data(), sizeof(responseSize)); data->d_buffer.resize(ntohs(responseSize)); data->d_tcpState = HealthCheckData::TCPState::ReadingResponse; }