parse_object: try internal cache before reading object db
[gitweb.git] / bundle.c
index 4742f2734eeb3dee117ab02a422056cfee4f71ea..b8acf3c18b600f1f413f95744ad281e3879b3f6e 100644 (file)
--- 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;