diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-10-06 22:46:17 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-10-06 22:46:17 +0000 |
commit | 0fb9e8dd7d85d7437ea0722941e7e76d3e10c3be (patch) | |
tree | 7479fce2af24e629f4bf559b082cf03203eaf94f /kerberosIV | |
parent | 7755d4b42a89b92aaa0e2f9e254a36b2d4b98278 (diff) |
use poll to avoid fd_set overflow
Diffstat (limited to 'kerberosIV')
-rw-r--r-- | kerberosIV/src/kadmin/admin_server.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/kerberosIV/src/kadmin/admin_server.c b/kerberosIV/src/kadmin/admin_server.c index 3e938684ab4..904c5849c68 100644 --- a/kerberosIV/src/kadmin/admin_server.c +++ b/kerberosIV/src/kadmin/admin_server.c @@ -265,7 +265,8 @@ kadm_listen(void) int found; int admin_fd; int peer_fd; - fd_set mask, readfds; + struct pollfd pfd[1]; + int nfds; struct sockaddr_in peer; int addrlen; int pid; @@ -293,8 +294,10 @@ kadm_listen(void) sizeof(struct sockaddr_in)) < 0) return KADM_NO_BIND; listen(admin_fd, 1); - FD_ZERO(&mask); - FD_SET(admin_fd, &mask); + + pfd[0].fd = admin_fd; + pfd[0].events = POLLIN; + pfd[0].revents = 0; for (;;) { /* loop nearly forever */ if (exit_now) { @@ -302,9 +305,7 @@ kadm_listen(void) kill_children(); return(0); } - readfds = mask; - if ((found = select(admin_fd+1, &readfds, 0, - 0, (struct timeval *)0)) == 0) + if ((found = poll(pfd, 1, 0) == 0) continue; /* no things read */ if (found < 0) { if (errno != EINTR) |