commit 3a1f7b08f9ad5f79fd7b8430028ed1ffe60d31c9
parent 03a509da002f4be9c9d40e4b7c88ec3cca357e95
Author: Jan Pobrislo <ccx@te2000.cz>
Date: Tue, 30 Jul 2024 13:01:14 +0000
Make sure select loop retains it's FDs
Diffstat:
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/fdrecv.c b/src/fdrecv.c
@@ -15,10 +15,10 @@ void wait_readable(int fd) {
fd_set rfds, xfds;
int retval = 0;
FD_ZERO(&rfds);
- FD_SET(fd, &rfds);
FD_ZERO(&xfds);
- FD_SET(fd, &xfds);
while(retval < 1) {
+ FD_SET(fd, &rfds);
+ FD_SET(fd, &xfds);
retval = select(fd+1, &rfds, NULL, &xfds, NULL);
if (retval == -1 && errno != EINTR) {
strerr_dief1sys(111, "select()");
diff --git a/src/fdrecvto.c b/src/fdrecvto.c
@@ -15,10 +15,10 @@ void wait_readable(int fd) {
fd_set rfds, xfds;
int retval = 0;
FD_ZERO(&rfds);
- FD_SET(fd, &rfds);
FD_ZERO(&xfds);
- FD_SET(fd, &xfds);
while(retval < 1) {
+ FD_SET(fd, &rfds);
+ FD_SET(fd, &xfds);
retval = select(fd+1, &rfds, NULL, &xfds, NULL);
if (retval == -1 && errno != EINTR) {
strerr_dief1sys(111, "select()");
diff --git a/src/fdsend.c b/src/fdsend.c
@@ -14,10 +14,10 @@ void wait_writable(int fd) {
fd_set wfds, xfds;
int retval = 0;
FD_ZERO(&wfds);
- FD_SET(fd, &wfds);
FD_ZERO(&xfds);
- FD_SET(fd, &xfds);
while(retval < 1) {
+ FD_SET(fd, &wfds);
+ FD_SET(fd, &xfds);
retval = select(fd+1, NULL, &wfds, &xfds, NULL);
if (retval == -1 && errno != EINTR) {
strerr_dief1sys(111, "select()");