X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fpoll.c;h=2cf68293ed8a211872a98ae5e4c91a2638b03b13;hb=5556cec1e3f87122e1b0e7bf82f1f75c57219a21;hp=3071b12655d6fd75b411e3951637fe70b3b50ca3;hpb=80a029602f5b2707ca8d2487843ecb9e0df74a6a;p=gnulib.git diff --git a/lib/poll.c b/lib/poll.c index 3071b1265..2cf68293e 100644 --- a/lib/poll.c +++ b/lib/poll.c @@ -1,7 +1,7 @@ /* Emulation for poll(2) Contributed by Paolo Bonzini. - Copyright 2001-2003, 2006-2012 Free Software Foundation, Inc. + Copyright 2001-2003, 2006-2013 Free Software Foundation, Inc. This file is part of gnulib. @@ -303,6 +303,10 @@ compute_revents (int fd, int sought, fd_set *rfds, fd_set *wfds, fd_set *efds) || socket_errno == ECONNABORTED || socket_errno == ENETRESET) happened |= POLLHUP; + /* some systems can't use recv() on non-socket, including HP NonStop */ + else if (socket_errno == ENOTSOCK) + happened |= (POLLIN | POLLRDNORM) & sought; + else happened |= POLLERR; } @@ -350,7 +354,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout) /* EFAULT is not necessary to implement, but let's do it in the simplest case. */ - if (!pfd) + if (!pfd && nfd) { errno = EFAULT; return -1; @@ -598,7 +602,7 @@ restart: if (!rc && timeout == INFTIM) { - SwitchToThread(); + SleepEx (1, TRUE); goto restart; }