Merge branch 'rs/strbuf-getwholeline-fix'
A helper function to read a single whole line into strbuf mistakenly triggered OOM error at EOF under certain conditions, which has been fixed. * rs/strbuf-getwholeline-fix: strbuf: clear errno before calling getdelim(3)
This commit is contained in:
commit
0c493966ff
1
strbuf.c
1
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 */
|
/* Translate slopbuf to NULL, as we cannot call realloc on it */
|
||||||
if (!sb->alloc)
|
if (!sb->alloc)
|
||||||
sb->buf = NULL;
|
sb->buf = NULL;
|
||||||
|
errno = 0;
|
||||||
r = getdelim(&sb->buf, &sb->alloc, term, fp);
|
r = getdelim(&sb->buf, &sb->alloc, term, fp);
|
||||||
|
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user