Merge branch 'jk/receive-pack-unpack-error-to-pusher'
[gitweb.git] / compat / poll / poll.c
index 49541f19cd1fa21de071ef0df214117bb4908d41..7d226ecb293ee3c5f9b17aa3e5e36b7c8701dbae 100644 (file)
@@ -306,6 +306,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 (/* (r == -1) && */ socket_errno == ENOTSOCK)
+       happened |= (POLLIN | POLLRDNORM) & sought;
+
       else
        happened |= POLLERR;
     }
@@ -353,7 +357,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;