From b7fafb5039036473a210234040ad8a9119b86d7d Mon Sep 17 00:00:00 2001 From: Oleg Oshmyan Date: Sat, 9 Sep 2017 00:59:55 +0300 Subject: [PATCH] sslh-select: invoke FD_CLR on fd before closing fd POSIX requires the fd argument to any FD_ macro to be valid. --- sslh-select.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sslh-select.c b/sslh-select.c index 8d279bb..2bee1e2 100644 --- a/sslh-select.c +++ b/sslh-select.c @@ -61,9 +61,9 @@ int tidy_connection(struct connection *cnx, fd_set *fds, fd_set *fds2) if (verbose) fprintf(stderr, "closing fd %d\n", cnx->q[i].fd); - close(cnx->q[i].fd); FD_CLR(cnx->q[i].fd, fds); FD_CLR(cnx->q[i].fd, fds2); + close(cnx->q[i].fd); if (cnx->q[i].deferred_data) free(cnx->q[i].deferred_data); }