Update IXSelectInterruptPipe.cpp (#502)

Valgrind keeps complaining that close() on the invalid descriptor -1 is happening here. I suppose that close shouldn't be called when the descriptor value is known to be invalid. It's not a fatal error or something, but this practice is able to create a lot of flood in the logs.
This commit is contained in:
CryptoManiac 2024-03-19 08:24:11 +03:00 committed by GitHub
parent 39e085bebc
commit 98b4828e93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,8 +34,12 @@ namespace ix
SelectInterruptPipe::~SelectInterruptPipe() SelectInterruptPipe::~SelectInterruptPipe()
{ {
::close(_fildes[kPipeReadIndex]); if (-1 != _fildes[kPipeReadIndex]) {
::close(_fildes[kPipeWriteIndex]); ::close(_fildes[kPipeReadIndex]);
}
if (-1 != _fildes[kPipeWriteIndex]) {
::close(_fildes[kPipeWriteIndex]);
}
_fildes[kPipeReadIndex] = -1; _fildes[kPipeReadIndex] = -1;
_fildes[kPipeWriteIndex] = -1; _fildes[kPipeWriteIndex] = -1;
} }