Skip to content

Commit

Permalink
Merge pull request #14792 from rgacogne/ddist-coverity-202410
Browse files Browse the repository at this point in the history
dnsdist: Fix Coverity warning 445614: " Argument cannot be negative"
  • Loading branch information
rgacogne authored Nov 4, 2024
2 parents 021f88f + 34e86b2 commit 4a65f56
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pdns/dnsdistdist/dnsdist-cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,11 @@ uint64_t DNSDistPacketCache::getEntriesCount()

uint64_t DNSDistPacketCache::dump(int fileDesc, bool rawResponse)
{
auto filePtr = pdns::UniqueFilePtr(fdopen(dup(fileDesc), "w"));
auto fileDescDuplicated = dup(fileDesc);
if (fileDescDuplicated < 0) {
return 0;
}
auto filePtr = pdns::UniqueFilePtr(fdopen(fileDescDuplicated, "w"));
if (filePtr == nullptr) {
return 0;
}
Expand Down

0 comments on commit 4a65f56

Please sign in to comment.