write_name_quoted(): make one of the path a counted string.
[gitweb.git] / strbuf.c
index d381c1d95bec4873bff07c97ebee9c4fc3f3d980..9d9d8bed915483abbc2ebb340e0881ae4e296bd4 100644 (file)
--- 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,7 +37,7 @@ void read_line(struct strbuf *sb, FILE *fp, int term) {
                        break;
                strbuf_add(sb, ch);
        }
-       if (sb->len == 0)
+       if (ch == EOF && sb->len == 0)
                sb->eof = 1;
        strbuf_end(sb);
 }