mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
use pselect only when available.
This commit is contained in:
3
README
3
README
@@ -17,6 +17,9 @@ $ ./configure && make
|
||||
At the minimum this requires GnuTLS and libprotobuf-c headers and libraries
|
||||
installed. It will also link against libpam and libwrap, if present.
|
||||
|
||||
For the occtl tool the additional libraries, readline, and dbus are
|
||||
required.
|
||||
|
||||
When cross compiling it may be useful to add the --enable-local-libopts
|
||||
option to configure.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
AC_PREREQ(2.61)
|
||||
AC_INIT([ocserv], [0.3.0], [nmav@gnutls.org])
|
||||
AC_INIT([ocserv], [0.3.0pre0], [nmav@gnutls.org])
|
||||
PKG_PROG_PKG_CONFIG
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([gl/m4])
|
||||
@@ -114,7 +114,7 @@ AC_CHECK_MEMBER([struct sockaddr.sa_len],
|
||||
|
||||
AC_CHECK_HEADERS([net/if_tun.h linux/if_tun.h netinet/in_systm.h], [], [], [])
|
||||
|
||||
AC_CHECK_FUNCS([setproctitle clock_gettime isatty])
|
||||
AC_CHECK_FUNCS([setproctitle clock_gettime isatty pselect])
|
||||
|
||||
if [ test -z "$LIBWRAP" ];then
|
||||
libwrap_enabled="no"
|
||||
|
||||
12
src/main.c
12
src/main.c
@@ -775,7 +775,11 @@ int main(int argc, char** argv)
|
||||
struct ctl_handler_st* ctl_tmp = NULL, *ctl_pos;
|
||||
fd_set rd_set, wr_set;
|
||||
int n = 0, ret, flags;
|
||||
#ifdef HAVE_PSELECT
|
||||
struct timespec ts;
|
||||
#else
|
||||
struct timeval ts;
|
||||
#endif
|
||||
int cmd_fd[2];
|
||||
struct worker_st ws;
|
||||
struct cfg_st config;
|
||||
@@ -910,9 +914,17 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_PSELECT
|
||||
ts.tv_nsec = 0;
|
||||
ts.tv_sec = 30;
|
||||
ret = pselect(n + 1, &rd_set, &wr_set, NULL, &ts, &emptyset);
|
||||
#else
|
||||
ts.tv_usec = 0;
|
||||
ts.tv_sec = 30;
|
||||
sigprocmask(SIG_UNBLOCK, &blockset, NULL);
|
||||
ret = select(n + 1, &rd_set, &wr_set, NULL, &ts);
|
||||
sigprocmask(SIG_BLOCK, &blockset, NULL);
|
||||
#endif
|
||||
if (ret == -1 && errno == EINTR)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user