From b6fe381f0ee21b9eac16cb872878d5d534b9e82e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Fri, 21 May 2021 23:42:31 -0400
Subject: [PATCH] Fix console and connect events when using select()

---
 src/sbbs3/js_internal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/js_internal.c b/src/sbbs3/js_internal.c
index f32730db4e..ee30f3c070 100644
--- a/src/sbbs3/js_internal.c
+++ b/src/sbbs3/js_internal.c
@@ -1330,7 +1330,7 @@ js_handle_events(JSContext *cx, js_callback_t *cb, volatile int *terminated)
 #ifdef PREFER_POLL
 						if (fds[cfd].revents & ~(POLLOUT | POLLWRNORM | POLLWRBAND)) {
 #else
-						if (FD_ISSET(ev->data.connect.sv[0], &wfds)) {
+						if (FD_ISSET(ev->data.connect.sv[0], &rfds)) {
 #endif
 							closesocket(ev->data.connect.sv[0]);
 							break;
@@ -1343,7 +1343,7 @@ js_handle_events(JSContext *cx, js_callback_t *cb, volatile int *terminated)
 #ifdef PREFER_POLL
 						if (fds[cfd].revents & ~(POLLOUT | POLLWRNORM | POLLWRBAND)) {
 #else
-						if (FD_ISSET(ev->data.sock, &wfds)) {
+						if (FD_ISSET(ev->data.sock, &rfds)) {
 #endif
 							break;
 						}
-- 
GitLab