From c83fcd876c103a84b22cbfae7e48a24a71a4c37a Mon Sep 17 00:00:00 2001 From: mycroft Date: Fri, 20 Sep 2002 22:05:59 +0000 Subject: [PATCH] select() -> poll() --- crypto/dist/heimdal/lib/krb5/changepw.c | 13 ++++++++++++- crypto/dist/heimdal/lib/krb5/send_to_kdc.c | 14 +++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/crypto/dist/heimdal/lib/krb5/changepw.c b/crypto/dist/heimdal/lib/krb5/changepw.c index 62b6e8b1b9c0..05562314c527 100644 --- a/crypto/dist/heimdal/lib/krb5/changepw.c +++ b/crypto/dist/heimdal/lib/krb5/changepw.c @@ -34,7 +34,7 @@ #include __RCSID("$Heimdal: changepw.c,v 1.37 2002/09/03 16:14:34 nectar Exp $" - "$NetBSD: changepw.c,v 1.7 2002/09/12 13:19:13 joda Exp $"); + "$NetBSD: changepw.c,v 1.8 2002/09/20 22:05:59 mycroft Exp $"); static krb5_error_code send_request (krb5_context context, @@ -300,8 +300,12 @@ krb5_change_password (krb5_context context, } for (i = 0; !done && i < 5; ++i) { +#ifdef HAVE_POLL + struct pollfd set[1]; +#else fd_set fdset; struct timeval tv; +#endif if (!replied) { replied = 0; @@ -317,6 +321,12 @@ krb5_change_password (krb5_context context, } } +#ifdef HAVE_POLL + set[0].fd = sock; + set[0].events = POLLIN; + + ret = poll (set, 1, (1 + (1 << i)) * 1000); +#else if (sock >= FD_SETSIZE) { krb5_set_error_string(context, "fd %d too large", sock); ret = ERANGE; @@ -330,6 +340,7 @@ krb5_change_password (krb5_context context, tv.tv_sec = 1 + (1 << i); ret = select (sock + 1, &fdset, NULL, NULL, &tv); +#endif if (ret < 0 && errno != EINTR) { close(sock); goto out; diff --git a/crypto/dist/heimdal/lib/krb5/send_to_kdc.c b/crypto/dist/heimdal/lib/krb5/send_to_kdc.c index 6b6beb846c29..34b016d2875e 100644 --- a/crypto/dist/heimdal/lib/krb5/send_to_kdc.c +++ b/crypto/dist/heimdal/lib/krb5/send_to_kdc.c @@ -34,7 +34,7 @@ #include "krb5_locl.h" __RCSID("$Heimdal: send_to_kdc.c,v 1.48 2002/03/27 09:32:50 joda Exp $" - "$NetBSD: send_to_kdc.c,v 1.6 2002/09/12 13:19:18 joda Exp $"); + "$NetBSD: send_to_kdc.c,v 1.7 2002/09/20 22:05:59 mycroft Exp $"); /* * send the data in `req' on the socket `fd' (which is datagram iff udp) @@ -50,22 +50,34 @@ recv_loop (int fd, size_t limit, krb5_data *rep) { +#ifdef HAVE_POLL + struct pollfd set[1]; +#else fd_set fdset; struct timeval timeout; +#endif int ret; int nbytes; +#ifndef HAVE_POLL if (fd >= FD_SETSIZE) { return -1; } +#endif krb5_data_zero(rep); do { +#ifdef HAVE_POLL + set[0].fd = fd; + set[0].events = POLLIN; + ret = poll (set, 1, tmout * 1000); +#else FD_ZERO(&fdset); FD_SET(fd, &fdset); timeout.tv_sec = tmout; timeout.tv_usec = 0; ret = select (fd + 1, &fdset, NULL, NULL, &timeout); +#endif if (ret < 0) { if (errno == EINTR) continue;