]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/upload-archive.c
upload-archive: fix infinite loop on Cygwin
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Wed, 17 Jun 2009 10:11:10 +0000 (12:11 +0200)
committerJunio C Hamano <gitster@pobox.com>
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 <bobkagy@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-upload-archive.c