Fix unitialized memory

This commit is contained in:
alesapin 2020-11-27 14:57:48 +03:00
parent d199a2bf76
commit 00c190aeed

View File

@ -163,12 +163,15 @@ struct SocketInterruptablePollWrapper
{ {
UInt8 byte; UInt8 byte;
read_result = read(pipe.fds_rw[0], &byte, sizeof(byte)); read_result = read(pipe.fds_rw[0], &byte, sizeof(byte));
if (byte == WATCH_RESPONSE_BYTE) if (read_result > 0)
result |= HAS_WATCH_RESPONSE; {
else if (byte == RESPONSE_BYTE) if (byte == WATCH_RESPONSE_BYTE)
result |= HAS_RESPONSE; result |= HAS_WATCH_RESPONSE;
else else if (byte == RESPONSE_BYTE)
throw Exception("Unexpected byte received from signaling pipe", ErrorCodes::UNEXPECTED_PACKET_FROM_CLIENT); result |= HAS_RESPONSE;
else
throw Exception("Unexpected byte received from signaling pipe", ErrorCodes::UNEXPECTED_PACKET_FROM_CLIENT);
}
} }
while (read_result > 0 || (read_result < 0 && errno == EINTR)); while (read_result > 0 || (read_result < 0 && errno == EINTR));