Skip to content

Commit 61b2a1a

Browse files
rsbeckercagitster
authored andcommitted
poll.c: always set revents, even if to zero
Match what is done to pfd[i].revents when compute_revents() returns 0 to the upstream gnulib's commit d42461c3 ("poll: fixes for large fds", 2015-02-20). The revents field is set to 0, without incrementing the value rc to be returned from the function. The original code left the field to whatever random value the field was initialized to. This fixes occasional hangs in git-upload-pack on HPE NonStop. Signed-off-by: Randall S. Becker <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9752ad0 commit 61b2a1a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compat/poll/poll.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)
438438
pfd[i].revents = happened;
439439
rc++;
440440
}
441+
else
442+
{
443+
pfd[i].revents = 0;
444+
}
441445
}
442446

443447
return rc;

0 commit comments

Comments
 (0)