From aeb649da213ff280b55895af5c7a8708be544212 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Wed, 3 Dec 1997 16:05:00 +0000 Subject: [PATCH] maxfd bugs when we run out of files? --- test-suite/tcp-banger2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test-suite/tcp-banger2.c b/test-suite/tcp-banger2.c index e9e236d89c..2e4639fbab 100644 --- a/test-suite/tcp-banger2.c +++ b/test-suite/tcp-banger2.c @@ -124,7 +124,7 @@ fd_close(int fd) FD[fd].data = NULL; nfds--; if (fd == maxfd) { - while (FD[fd].cb == NULL) + while (fd > 0 && FD[fd].cb == NULL) fd--; maxfd = fd; } @@ -292,6 +292,7 @@ main(argc, argv) FD_SET(i, &R); } if (select(maxfd + 1, &R, NULL, NULL, &to) < 0) { + printf("maxfd=%d\n", maxfd); if (errno != EINTR) perror("select"); continue; -- 2.47.3