1
0
mirror of https://github.com/git/git synced 2024-07-05 00:58:49 +00:00

[PATCH] fix strbuf take #2

I just remembered why I placed that bogus "sb->len ==0 implies
sb->eof" condition there.  We need at least something like this
to catch the normal EOF (that is, line termination immediately
followed by EOF) case.  "if (feof(fp))" fires when we have
already read the eof, not when we are about read it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Junio C Hamano 2005-05-18 23:34:03 -07:00 committed by Linus Torvalds
parent 9b632be30c
commit 9dc527adbc

View File

@ -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);
}