summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan T. DeKok <aland@freeradius.org>2017-02-08 13:27:17 -0500
committerAlan T. DeKok <aland@freeradius.org>2017-02-08 13:27:17 -0500
commit803af556aa19696fbdc17c955a0ce9cc14f5fc27 (patch)
tree3fda21b2ce411a89eeef4c329736dfc6ed5166da /src
parent7de12391916f9d5a6bb2543e9338ca0b6f7eb6fc (diff)
downloadlibpam-radius-auth-803af556aa19696fbdc17c955a0ce9cc14f5fc27.tar.gz
libpam-radius-auth-803af556aa19696fbdc17c955a0ce9cc14f5fc27.zip
Check for poll.h and use that if it exists
Diffstat (limited to 'src')
-rw-r--r--src/config.h.in3
-rw-r--r--src/pam_radius_auth.c8
-rw-r--r--src/pam_radius_auth.h2
3 files changed, 8 insertions, 5 deletions
diff --git a/src/config.h.in b/src/config.h.in
index 4780376..4cc9789 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -62,6 +62,9 @@
/* Define to 1 if you have the <pam/pam_modules.h> header file. */
#undef HAVE_PAM_PAM_MODULES_H
+/* Define to 1 if you have the <poll.h> header file. */
+#undef HAVE_POLL_H
+
/* Define to 1 if you have the <security/pam_appl.h> header file. */
#undef HAVE_SECURITY_PAM_APPL_H
diff --git a/src/pam_radius_auth.c b/src/pam_radius_auth.c
index b7c4e96..a27f90b 100644
--- a/src/pam_radius_auth.c
+++ b/src/pam_radius_auth.c
@@ -709,7 +709,7 @@ static int talk_radius(radius_conf_t *conf, AUTH_HDR *request, AUTH_HDR *respons
{
socklen_t salen;
int total_length;
-#ifdef WITH_POLL
+#ifdef HAVE_POLL_H
struct pollfd pollfds[1];
#else
fd_set set;
@@ -785,7 +785,7 @@ static int talk_radius(radius_conf_t *conf, AUTH_HDR *request, AUTH_HDR *respons
tv.tv_usec = 0;
end = now + tv.tv_sec;
-#ifdef WITH_POLL
+#ifdef HAVE_POLL_H
pollfds[0].fd = conf->sockfd; /* wait only for the RADIUS UDP socket */
pollfds[0].events = POLLIN; /* wait for data to read */
#else
@@ -796,7 +796,7 @@ static int talk_radius(radius_conf_t *conf, AUTH_HDR *request, AUTH_HDR *respons
/* loop, waiting for the network to return data */
ok = TRUE;
while (ok) {
-#ifdef WITH_POLL
+#ifdef HAVE_POLL_H
rcode = poll((struct pollfd *) &pollfds, 1, tv.tv_sec * 1000);
#else
rcode = select(conf->sockfd + 1, &set, NULL, NULL, &tv);
@@ -838,7 +838,7 @@ static int talk_radius(radius_conf_t *conf, AUTH_HDR *request, AUTH_HDR *respons
}
/* the call returned OK */
-#ifdef WITH_POLL
+#ifdef HAVE_POLL_H
} else if (pollfds[0].revents & POLLIN) {
#else
} else if (FD_ISSET(conf->sockfd, &set)) {
diff --git a/src/pam_radius_auth.h b/src/pam_radius_auth.h
index 742e912..b3f7839 100644
--- a/src/pam_radius_auth.h
+++ b/src/pam_radius_auth.h
@@ -25,7 +25,7 @@
#include <fcntl.h>
#include <arpa/inet.h>
-#ifdef WITH_POLL
+#ifdef HAVE_POLL_H
#include <poll.h>
#endif