Do not increase size in _fgets if we reach the EOF.

This commit is contained in:
Patrick Pelissier committed 2017-07-05 23:31:33 +02:00
1 parent dbe24395f4
commit 5fae797e41
1 file changed
+4 -1
+4 -1
View File
@@ -552,8 +552,11 @@ string_fgets(string_t v, FILE *f, string_fgets_t arg)
}
STRING_CONTRACT(v);
return;
} else if (p == NULL)
} else if (p == NULL && !feof(f)) {
/* The string buffer is not big enough:
increase it and continue reading */
stringi_fit2size (v, v->alloc + v->alloc/2);
}
}
STRING_CONTRACT (v);
}