From 0523278a98ef16f3d5b36d14d35492f403ae8f21 Mon Sep 17 00:00:00 2001 From: Daniel Balla Date: Mon, 24 Sep 2018 09:21:35 +0200 Subject: [PATCH] Fix not checking errno after calling recv() (#2538) There was an issue not checking if recv() set the error value to EWOULDBLOCK or EAGAIN (both equals 11). If recv() returns 0 that means the connection was gracefully closed from the other side. However, if you are using non-blocking sockets, and recv() returns 0, but sets the errno to EWOULDBLOCK or EAGAIN it means the socket operation would block. This patch fixes #2537 JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu --- jerry-ext/debugger/debugger-tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jerry-ext/debugger/debugger-tcp.c b/jerry-ext/debugger/debugger-tcp.c index 92f26e490..31f8d4699 100644 --- a/jerry-ext/debugger/debugger-tcp.c +++ b/jerry-ext/debugger/debugger-tcp.c @@ -78,7 +78,7 @@ jerryx_debugger_tcp_send (jerry_debugger_transport_header_t *header_p, /**< tcp { ssize_t is_err = recv (tcp_p->tcp_socket, NULL, 0, MSG_PEEK); - if (is_err == 0) + if (is_err == 0 && errno != EWOULDBLOCK) { int err_val = errno; jerry_debugger_transport_close ();