From 8148237cb4ae20755c06a44d71761c7030973c3d Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Thu, 25 Nov 2021 11:13:17 +0900 Subject: posix: Use poll instead, when available, removing use of select. * configure.ac (HAVE_POLL_H): Add the check. * src/ath.c [!HAVE_POLL_H] (ath_select): Enable conditionally. * src/posix-io.c [HAVE_POLL_H] (_gpgme_io_select_poll): Use poll. * tests/gpg/t-cancel.c [HAVE_POLL_H] (do_select): Use poll. * tests/gpg/t-eventloop.c [HAVE_POLL_H] (do_select): Use poll. -- GnuPG-bug-id: 2385 Signed-off-by: NIIBE Yutaka --- src/ath.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/ath.c') diff --git a/src/ath.c b/src/ath.c index 6cc84aa5..996143dc 100644 --- a/src/ath.c +++ b/src/ath.c @@ -26,11 +26,15 @@ #ifdef HAVE_UNISTD_H # include #endif -#ifdef HAVE_SYS_SELECT_H -# include +#ifdef HAVE_POLL_H +# include #else -# ifdef HAVE_SYS_TIME_H -# include +# ifdef HAVE_SYS_SELECT_H +# include +# else +# ifdef HAVE_SYS_TIME_H +# include +# endif # endif #endif #ifdef HAVE_SYS_TYPES_H @@ -89,6 +93,7 @@ ath_write (int fd, const void *buf, size_t nbytes) } +#if !defined(HAVE_POLL_H) gpgme_ssize_t ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, struct timeval *timeout) @@ -99,7 +104,7 @@ ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, return select (nfd, rset, wset, eset, timeout); #endif } - +#endif gpgme_ssize_t ath_waitpid (pid_t pid, int *status, int options) -- cgit v1.2.3