From 54440e154f33678a80ea9f77085730b81a5e9446 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Tue, 3 Jan 2012 05:46:03 -0800 Subject: fix hang in git fetch if pointed at a 0 length bundle git-repo if interupted at the exact wrong time will generate zero length bundles- literal empty files. git-repo is wrong here, but git fetch shouldn't effectively spin loop if pointed at a zero length bundle. Signed-off-by: Brian Harring Helped-by: Johannes Sixt Helped-by: Nguyen Thai Ngoc Duy Signed-off-by: Junio C Hamano --- bundle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bundle.c') diff --git a/bundle.c b/bundle.c index 08020bc3a2..8a1d53ba29 100644 --- a/bundle.c +++ b/bundle.c @@ -31,8 +31,8 @@ static int strbuf_readline_fd(struct strbuf *sb, int fd) while (1) { char ch; ssize_t len = xread(fd, &ch, 1); - if (len < 0) - return -1; + if (len <= 0) + return len; strbuf_addch(sb, ch); if (ch == '\n') break; -- cgit v1.2.3