Skip to content

Commit

Permalink
dnsdist: Fix Coverity warning 445614: " Argument cannot be negative"
Browse files Browse the repository at this point in the history
  • Loading branch information
rgacogne committed Oct 22, 2024
1 parent 5abafe9 commit 34e86b2
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 34e86b2

Please sign in to comment.