X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=strbuf.c;h=9d9d8bed915483abbc2ebb340e0881ae4e296bd4;hb=HEAD;hp=654330849c3f5d1502d0116c71595b9fa4613186;hpb=ad87de7c9d191df4fbd5cbcb2f767520201688ae;p=git.git diff --git a/strbuf.c b/strbuf.c index 65433084..9d9d8bed 100644 --- a/strbuf.c +++ b/strbuf.c @@ -4,7 +4,7 @@ #include "cache.h" void strbuf_init(struct strbuf *sb) { - sb->buf = 0; + sb->buf = NULL; sb->eof = sb->alloc = sb->len = 0; } @@ -37,6 +37,8 @@ void read_line(struct strbuf *sb, FILE *fp, int term) { break; strbuf_add(sb, ch); } + if (ch == EOF && sb->len == 0) + sb->eof = 1; strbuf_end(sb); }