summaryrefslogtreecommitdiff
path: root/builtin-upload-archive.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-06-20 21:46:55 -0700
committerJunio C Hamano <gitster@pobox.com>2009-06-20 21:46:55 -0700
commitb58f6b50c1032a8ac56ab09e99500d43da3919d1 (patch)
tree8c7ad9f6c2e5818a22752a028dead822ea5500e0 /builtin-upload-archive.c
parent09236d80480c15f6da804e56a80c08d320475fb1 (diff)
parent1b19fa46344f512949270dc88089574950519ea3 (diff)
downloadgit-b58f6b50c1032a8ac56ab09e99500d43da3919d1.tar.gz
Merge branch 'pb/maint-1.6.2-userdiff-fix'
* pb/maint-1.6.2-userdiff-fix: upload-archive: fix infinite loop on Cygwin avoid exponential regex match for java and objc function names
Diffstat (limited to 'builtin-upload-archive.c')
-rw-r--r--builtin-upload-archive.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c
index 0206b416cb..c4cd1e1327 100644
--- a/builtin-upload-archive.c
+++ b/builtin-upload-archive.c
@@ -80,16 +80,17 @@ static void error_clnt(const char *fmt, ...)
die("sent error to the client: %s", buf);
}
-static void process_input(int child_fd, int band)
+static ssize_t process_input(int child_fd, int band)
{
char buf[16384];
ssize_t sz = read(child_fd, buf, sizeof(buf));
if (sz < 0) {
if (errno != EAGAIN && errno != EINTR)
error_clnt("read error: %s\n", strerror(errno));
- return;
+ return sz;
}
send_sideband(1, band, buf, sz, LARGE_PACKET_MAX);
+ return sz;
}
int cmd_upload_archive(int argc, const char **argv, const char *prefix)
@@ -131,6 +132,7 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
while (1) {
struct pollfd pfd[2];
+ ssize_t processed[2] = { 0, 0 };
int status;
pfd[0].fd = fd1[0];
@@ -147,12 +149,12 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
}
if (pfd[0].revents & POLLIN)
/* Data stream ready */
- process_input(pfd[0].fd, 1);
+ processed[0] = process_input(pfd[0].fd, 1);
if (pfd[1].revents & POLLIN)
/* Status stream ready */
- process_input(pfd[1].fd, 2);
+ processed[1] = process_input(pfd[1].fd, 2);
/* Always finish to read data when available */
- if ((pfd[0].revents | pfd[1].revents) & POLLIN)
+ if (processed[0] || processed[1])
continue;
if (waitpid(writer, &status, 0) < 0)