diff --git a/ixwebsocket/IXSelectInterruptPipe.cpp b/ixwebsocket/IXSelectInterruptPipe.cpp index 75c42f27..0518994a 100644 --- a/ixwebsocket/IXSelectInterruptPipe.cpp +++ b/ixwebsocket/IXSelectInterruptPipe.cpp @@ -34,8 +34,12 @@ namespace ix SelectInterruptPipe::~SelectInterruptPipe() { - ::close(_fildes[kPipeReadIndex]); - ::close(_fildes[kPipeWriteIndex]); + if (-1 != _fildes[kPipeReadIndex]) { + ::close(_fildes[kPipeReadIndex]); + } + if (-1 != _fildes[kPipeWriteIndex]) { + ::close(_fildes[kPipeWriteIndex]); + } _fildes[kPipeReadIndex] = -1; _fildes[kPipeWriteIndex] = -1; }