Re: OS X poll breakage (Was: Please help test recent changes)

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



On Tue, 11 Jan 2022, Damien Miller wrote:

> So I think we need a HAVE_BROKEN_POLL :(

This seems to work. I don't think the preprocessor will do the right thing
if we have to support a system with BROKEN_POLL && HAVE_PPOLL, but we can
cross that bridge if we come to it...

diff --git a/configure.ac b/configure.ac
index 1feb73ef9..eb265143b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -731,6 +731,10 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
 	# proc_pidinfo()-based closefrom() replacement.
 	AC_CHECK_HEADERS([libproc.h])
 	AC_CHECK_FUNCS([proc_pidinfo])
+	# poll(2) is broken for character-special devices (at least).
+	# cf. Apple bug 3710161 (not public, but searchable)
+	AC_DEFINE([BROKEN_POLL], [1],
+	    [System poll(2) implementation is broken])
 	;;
 *-*-dragonfly*)
 	SSHDLIBS="$SSHDLIBS -lcrypt"
diff --git a/openbsd-compat/bsd-poll.c b/openbsd-compat/bsd-poll.c
index 2d28eed5b..8084776ce 100644
--- a/openbsd-compat/bsd-poll.c
+++ b/openbsd-compat/bsd-poll.c
@@ -15,7 +15,7 @@
  */
 
 #include "includes.h"
-#if !defined(HAVE_PPOLL) || !defined(HAVE_POLL)
+#if !defined(HAVE_PPOLL) || !defined(HAVE_POLL) || defined(BROKEN_POLL)
 
 #include <sys/types.h>
 #include <sys/time.h>
@@ -29,7 +29,7 @@
 #include <unistd.h>
 #include "bsd-poll.h"
 
-#ifndef HAVE_PPOLL
+#if !defined(HAVE_PPOLL) || defined(BROKEN_POLL)
 /*
  * A minimal implementation of ppoll(2), built on top of pselect(2).
  *
@@ -109,9 +109,9 @@ out:
 		errno = saved_errno;
 	return ret;
 }
-#endif /* HAVE_PPOLL */
+#endif /* !HAVE_PPOLL || BROKEN_POLL */
 
-#ifndef HAVE_POLL
+#if !defined(HAVE_POLL) || defined(BROKEN_POLL)
 int
 poll(struct pollfd *fds, nfds_t nfds, int timeout)
 {
@@ -126,6 +126,6 @@ poll(struct pollfd *fds, nfds_t nfds, int timeout)
 
 	return ppoll(fds, nfds, tsp, NULL);
 }
-#endif /* HAVE_POLL */
+#endif /* !HAVE_POLL || BROKEN_POLL */
 
-#endif /* HAVE_PPOLL || HAVE_POLL */
+#endif /* !HAVE_PPOLL || !HAVE_POLL || BROKEN_POLL */
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux