> From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > Sent: Friday, September 07, 2012 4:47 PM > To: Joachim Schmitz > Cc: bug-gnulib@gnu.org; rsbec...@nexbridge.com > Subject: Re: poll() emulation in git/gnulib > > Il 07/09/2012 12:58, Joachim Schmitz ha scritto: > >> From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > >> Bonzini > >> Sent: Friday, September 07, 2012 11:41 AM > >> To: Joachim Schmitz > >> Cc: g...@vger.kernel.org; 'Junio C Hamano'; 'Erik Faye-Lund'; > >> bug-gnulib@gnu.org; rsbec...@nexbridge.com > >> Subject: Re: poll() emulation in git > >> > >> Il 07/09/2012 09:39, Joachim Schmitz ha scritto: > >>>>> I suppose it works to always handle ENOTSOCK that way, even on > >>>>> non-__TANDEM systems. > >>> Will you be fixing this in gnulib? How? > >> > >> I don't have access to the system, so it's best if you post the patches > >> yourself to bug-gnulib and git mailing lists (separately, since the code > >> is cross-pollinated but forked). > > > > Here's the patch hat fixed the problems for me. > > Whether or not to keep the #ifdef __TANDEM and/or to enable the commented > > additional check, to make it usable for non HP NonStop I > > don't know... > > Please remove it,
Remove what, just the "#ifdef __TANDEM" and "#endif" or the comment for the "(r == -1) &&" too? >and change the comment to "some systems can't use > recv() on non-socket, including HP NonStop". OK. > Also please add a ChangeLog. I'll commit the patch then. An entry in the ChangeLog file, right? Assuming this and that you just want the #ifdef __TANDEM removed: diff --git a/ChangeLog b/ChangeLog index 282e060..8e51746 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-09-06 Joachim Schmitz <j...@schmitz-digital.de> + + poll: fix for systems that can't recv() on a non-socket + poll: don't exit early if NULL is the 1st arg to poll() + 2012-09-06 Eric Blake <ebl...@redhat.com> net_if: give more details about the bug being fixeddiff --git a/lib/poll.c b/lib/poll.c index 5ad9d86..62430bb 100644 --- a/lib/poll.c +++ b/lib/poll.c @@ -303,6 +303,10 @@ compute_revents (int fd, int sought, fd_set *rfds, fd_set * || socket_errno == ECONNABORTED || socket_errno == ENETRESET) happened |= POLLHUP; + /* some systems can't use recv() on non-socket, including HP NonStop */ + else if (/* (r == -1) && */ 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;