Don't use poll() on Mac OS

Congratulations, Apple. Your OS is really great. In some versions (according to
google, it used to work in older releases), poll() can only handle sockets. If
you give it a pipe (as e.g. the shell module does), it will fail with POLLNVAL
which Csocket handles by going into an endless loop.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter
2011-04-03 18:04:14 +02:00
parent e51b7daedc
commit 72c1fa0c90
+18 -1
View File
@@ -160,7 +160,24 @@ if test "x$GXX" = "xyes"; then
fi
if test "$POLL" = "yes"; then
AC_DEFINE([CSOCK_USE_POLL], [1], [Use poll() instead of select()])
# poll() is broken on Mac OS, it fails with POLLNVAL for pipe()s.
if test -n "$ISDARWIN"
then
# Did they give us --enable-poll?
if test -n "$enable_poll"
then
# Yes, they asked for this.
AC_MSG_WARN([poll() is known to be broken on Mac OS X. You have been warned.])
else
# No, our default value of "yes" got applied.
AC_MSG_WARN([poll() is known to be broken on Mac OS X. Using select() instead.])
AC_MSG_WARN([Use --enable-poll for forcing poll() to be used.])
POLL=no
fi
fi
if test "$POLL" = "yes"; then
AC_DEFINE([CSOCK_USE_POLL], [1], [Use poll() instead of select()])
fi
fi
AC_CHECK_LIB( gnugetopt, getopt_long,)