upload-archive: fix infinite loop on Cygwin
authorRené Scharfe <redacted>
Wed, 17 Jun 2009 10:11:10 +0000 (12:11 +0200)
committerJunio C Hamano <redacted>
Thu, 18 Jun 2009 16:52:28 +0000 (09:52 -0700)
commit1b19fa46344f512949270dc88089574950519ea3
tree5bdf2ee8230e8dc390d2822edc2c3bd7492a0ffe
parent959e2e64a594e2fb8de2585078e31b07a8da6fc9
upload-archive: fix infinite loop on Cygwin

On Cygwin, poll() reports POLLIN even for file descriptors that have
reached their end.  This caused git upload-archive to be stuck in an
infinite loop, as it only looked at the POLLIN flag.

In addition to POLLIN, check if read() returned 0, which indicates
end-of-file, and keep looping only as long as at least one of the file
descriptors has input.  This lets the following command finish on its
own when run in a git repository on Cygwin, instead of it getting stuck
after printing all file names:

$ git archive -v --remote . HEAD >/dev/null

Reported-by: Bob Kagy <redacted>
Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
builtin-upload-archive.c
git clone https://git.99rst.org/PROJECT