summaryrefslogtreecommitdiffstats
path: root/strbuf.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-19 08:34:03 +0200
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-19 16:31:23 +0200
commit9dc527adbc013b67cd85cce67bdccc3c10ed4792 (patch)
tree7ec4c720ba190e5082ac7f1c809f24bedc0fd3c0 /strbuf.c
parentmerge-base: use the new lookup_commit_reference() helper function (diff)
downloadgit-9dc527adbc013b67cd85cce67bdccc3c10ed4792.tar.xz
git-9dc527adbc013b67cd85cce67bdccc3c10ed4792.zip
[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>
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/strbuf.c b/strbuf.c
index 654330849c..672a1e4097 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -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);
}