poll() exits too early with EFAULT if 1st arg is NULL
[gitweb.git] / compat / poll / poll.c
index 49541f19cd1fa21de071ef0df214117bb4908d41..e4b8319fb7335bfc31eb3e1e96605f077e2b568d 100644 (file)
@@ -353,7 +353,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;