diff options
author | Brian Harring <ferringb@gmail.com> | 2012-01-03 17:46:03 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-04 00:13:28 +0400 |
commit | 54440e154f33678a80ea9f77085730b81a5e9446 (patch) | |
tree | b78597fad5116212617d606beab521ca58ed011b /bundle.c | |
parent | f3f778df6900881a7bac409c927931c32b82bcb5 (diff) |
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 <ferringb@chromium.org>
Helped-by: Johannes Sixt
Helped-by: Nguyen Thai Ngoc Duy
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bundle.c')
-rw-r--r-- | bundle.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |