mirror of git://anongit.mindrot.org/openssh.git
OS X poll(2) is broken; use compat replacement
Darwin's poll(2) implementation is broken. For character-special devices like /dev/null, it returns POLLNVAL when polled with POLLIN. Apparently this is Apple bug 3710161, which is AFAIK not public, but a websearch will find other OSS projects rediscovering it periodically since it was first identified in 2005 (!!)
This commit is contained in:
parent
613a6545fc
commit
61a1a6af22
|
@ -731,6 +731,10 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
|
||||||
# proc_pidinfo()-based closefrom() replacement.
|
# proc_pidinfo()-based closefrom() replacement.
|
||||||
AC_CHECK_HEADERS([libproc.h])
|
AC_CHECK_HEADERS([libproc.h])
|
||||||
AC_CHECK_FUNCS([proc_pidinfo])
|
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*)
|
*-*-dragonfly*)
|
||||||
SSHDLIBS="$SSHDLIBS -lcrypt"
|
SSHDLIBS="$SSHDLIBS -lcrypt"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#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/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "bsd-poll.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).
|
* A minimal implementation of ppoll(2), built on top of pselect(2).
|
||||||
*
|
*
|
||||||
|
@ -109,9 +109,9 @@ out:
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_PPOLL */
|
#endif /* !HAVE_PPOLL || BROKEN_POLL */
|
||||||
|
|
||||||
#ifndef HAVE_POLL
|
#if !defined(HAVE_POLL) || defined(BROKEN_POLL)
|
||||||
int
|
int
|
||||||
poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
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);
|
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 */
|
||||||
|
|
Loading…
Reference in New Issue