From e82c650bc481024cf42e916aee7f096f915855a1 Mon Sep 17 00:00:00 2001 From: stderr64 Date: Sun, 10 Sep 2023 18:43:03 +0300 Subject: Added extra check if the even is POLLIN --- https_server.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/https_server.h b/https_server.h index 4b1776f..8f5381d 100644 --- a/https_server.h +++ b/https_server.h @@ -19,7 +19,7 @@ void https_server_event_loop( server_socket_t *sv, client_info_t *cl, server_con int ev_count = 0; socklen_t cl_info_len = (socklen_t)sizeof( sv->client_info ); while ( (ev_count = poll(sv->pstruct, 1, 0)) != -1 ){ - if ( ev_count > 0 ){ + if ( (ev_count > 0) && sv->pstruct->revents & POLLIN ){ sv->client_socket_fd = accept( sv->socket_fd, (struct sockaddr*)&sv->client_info, &cl_info_len ); if ( sv->client_socket_fd == -1 ){ log_write( svcfg, logf, "Error: failed to accept connection" ); -- cgit v1.2.3-86-g962b