Skip to content

Commit 98b4828

Browse files
authored
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.
1 parent 39e085b commit 98b4828

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ixwebsocket/IXSelectInterruptPipe.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ namespace ix
3434

3535
SelectInterruptPipe::~SelectInterruptPipe()
3636
{
37-
::close(_fildes[kPipeReadIndex]);
38-
::close(_fildes[kPipeWriteIndex]);
37+
if (-1 != _fildes[kPipeReadIndex]) {
38+
::close(_fildes[kPipeReadIndex]);
39+
}
40+
if (-1 != _fildes[kPipeWriteIndex]) {
41+
::close(_fildes[kPipeWriteIndex]);
42+
}
3943
_fildes[kPipeReadIndex] = -1;
4044
_fildes[kPipeWriteIndex] = -1;
4145
}

0 commit comments

Comments
 (0)