build: require <poll.h>, not just poll()

io.c and socket.c include <poll.h> unconditionally, but configure only
required the function.  A system that exposes poll() through some other
header would pass configure and then fail to compile -- the AC_CHECK_HEADERS
result for poll.h was collected and never used.

Require the header too, with its own message.  Verified both ways: a normal
configure still succeeds, and forcing ac_cv_header_poll_h=no now stops with
"rsync requires <poll.h>" rather than failing later in the build.

(cherry picked from commit a0952930a1)
This commit is contained in:
Andrew Tridgell committed 2026-08-02 21:33:25 +10:00
1 parent a3d8ecc312
commit 83da1cefed
1 file changed
+7
+7
View File
@@ -895,7 +895,14 @@ dnl rsync's I/O readiness loops use poll() rather than select() so that a
dnl file descriptor at or above FD_SETSIZE cannot overflow an fd_set (which
dnl is undefined behaviour and could hang the transfer). poll() is in
dnl POSIX.1-2001; fail early and clearly if this target lacks it.
dnl
dnl io.c and socket.c include <poll.h> unconditionally, so the HEADER has to
dnl be required too: a system that exposes poll() through some other header
dnl would otherwise pass configure and then fail to compile.
AC_CHECK_FUNCS([poll], , [AC_MSG_ERROR([rsync requires poll(); please report the platform to the rsync developers])])
if test x"$ac_cv_header_poll_h" != x"yes"; then
AC_MSG_ERROR([rsync requires <poll.h>; please report the platform to the rsync developers])
fi
AC_CHECK_FUNCS(strcasecmp)
if test x"$ac_cv_func_strcasecmp" = x"no"; then