Skip to content

Commit 32fde65

Browse files
Jojo-Schmitzgitster
authored andcommitted
poll() exits too early with EFAULT if 1st arg is NULL
If poll() is used as a milli-second sleep, like in help.c, by passing a NULL in the 1st and a 0 in the 2nd arg, it exits with EFAULT. As per Paolo Bonzini, the original author, this is a bug and to be fixed Like in this commit, which is not to exit if the 2nd arg is 0. It got fixed In gnulib in the same manner the other day. Signed-off-by: Joachim Schmitz <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 98c573a commit 32fde65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/poll/poll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)
353353

354354
/* EFAULT is not necessary to implement, but let's do it in the
355355
simplest case. */
356-
if (!pfd)
356+
if (!pfd && nfd)
357357
{
358358
errno = EFAULT;
359359
return -1;

0 commit comments

Comments
 (0)