]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
If we have nfds_t, check if it's int or long.
authorDarren Tucker <dtucker@dtucker.net>
Fri, 17 Oct 2025 05:23:43 +0000 (16:23 +1100)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 17 Oct 2025 05:30:27 +0000 (16:30 +1100)
Should fix build on very old Mac OS X, eg 10.3.  Spotted and patch tested
by Sevan Janiyan.

configure.ac
openbsd-compat/bsd-poll.h

index db5211013f43c3b51834582d26879559dca89a09..916ba032e36dfec9b83e12a7e99b677288124559 100644 (file)
@@ -3773,6 +3773,24 @@ AC_CHECK_TYPES([nfds_t], , , [
 #endif
 ])
 
+if test "x$ac_cv_type_nfds_t" != "xyes"; then
+       AC_MSG_CHECKING([if poll nfds_t is unsigned long])
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
+#ifdef HAVE_SYS_POLL_H
+#include <sys/poll.h>
+#endif
+           int poll(struct pollfd *, unsigned long, int timeout);
+           ]], [[return poll(0, 0, 0);]])],
+           [AC_MSG_RESULT([yes])
+            AC_DEFINE(POLL_NFDS_T_ULONG, 1, [Define if poll 2nd arg is ulong])],
+           [AC_MSG_RESULT([no])]
+       )
+fi
+
 # Decide which sandbox style to use
 sandbox_arg=""
 AC_ARG_WITH([sandbox],
index 67fd8c66f80344e73c75203b5d34d9ba1b45c923..bebd5d87d05a1811a1a3c6f78961f002ec4b6f99 100644 (file)
@@ -72,7 +72,11 @@ typedef struct pollfd {
 #endif /* !HAVE_STRUCT_POLLFD_FD */
 
 #ifndef HAVE_NFDS_T
+# ifdef POLL_NFDS_T_ULONG
+typedef unsigned long  nfds_t;
+# else
 typedef unsigned int   nfds_t;
+# endif
 #endif
 
 #ifndef HAVE_POLL