提交 f5f4df34 authored 作者: Moises Silva's avatar Moises Silva 提交者: Anthony Minessale

Fix ESL infinite loop on handle_recv() when errno is already set

system calls do not clear errno, just set it in case of failure, so we
gotta make sure the recv() syscall really failed by checking the return value
上级 dfd591e9
......@@ -1233,7 +1233,7 @@ static esl_ssize_t handle_recv(esl_handle_t *handle, void *data, esl_size_t data
} else if ((activity & ESL_POLL_READ)) {
if (!(activity = recv(handle->sock, data, datalen, 0))) {
activity = -1;
} else if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
} else if (activity < 0 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) {
activity = 0;
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论