poll.c: always set revents, even if to zero
authorRandall S. Becker <randall.becker@nexbridge.ca>
Thu, 28 Sep 2017 22:47:17 +0000 (07:47 +0900)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Sep 2017 09:33:22 +0000 (18:33 +0900)
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 <randall.becker@nexbridge.ca>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/poll/poll.c
index b10adc780fc334383f2684d21fa1c5a8d92771b9..ae03b74a6f4e9c8ff6d519d9a784ab6b84179872 100644 (file)
@@ -438,6 +438,10 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)
            pfd[i].revents = happened;
            rc++;
          }
+       else
+         {
+           pfd[i].revents = 0;
+         }
       }
 
   return rc;