summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-22 17:29:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-22 17:29:15 (GMT)
commit0c493966ff6af8d2217aaa40dd6f7916bd992b0a (patch)
tree1774f32283a00734ac2739d0343dc7bf4c37bc5d /strbuf.c
parente2a2a1daacb43d8296baf155ae6ea0ec6e2f2b8d (diff)
parent642956cf455ff8635be32b3160b12369da73cfe2 (diff)
downloadgit-0c493966ff6af8d2217aaa40dd6f7916bd992b0a.zip
git-0c493966ff6af8d2217aaa40dd6f7916bd992b0a.tar.gz
git-0c493966ff6af8d2217aaa40dd6f7916bd992b0a.tar.bz2
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)
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/strbuf.c b/strbuf.c
index 89d22e3..323c49c 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) {