Don't call read() if sockpairR < 0.

Coverity #1450782.
pull/2215/head
Roger A. Light 4 years ago
parent 501690d312
commit a2ab20df13

@ -204,9 +204,9 @@ static int interruptible_sleep(struct mosquitto *mosq, time_t reconnect_delay)
int maxfd = 0;
#ifndef WIN32
while(read(mosq->sockpairR, &pairbuf, 1) > 0);
while(mosq->sockpairR != INVALID_SOCKET && read(mosq->sockpairR, &pairbuf, 1) > 0);
#else
while(recv(mosq->sockpairR, &pairbuf, 1, 0) > 0);
while(mosq->sockpairR != INVALID_SOCKET && recv(mosq->sockpairR, &pairbuf, 1, 0) > 0);
#endif
local_timeout.tv_sec = reconnect_delay;

Loading…
Cancel
Save