diff --git a/strbuf.c b/strbuf.c index 89d22e3b09..323c49ceb3 100644 --- a/strbuf.c +++ b/strbuf.c @@ -476,6 +476,7 @@ int strbuf_getwholeline(struct strbuf *sb, FILE *fp, int term) /* Translate slopbuf to NULL, as we cannot call realloc on it */ if (!sb->alloc) sb->buf = NULL; + errno = 0; r = getdelim(&sb->buf, &sb->alloc, term, fp); if (r > 0) {