Commit d6f9505d authored by Jonas Termansen's avatar Jonas Termansen

Made getdelim(3) follow POSIX-2008 a bit more closely.

It now reads lines that aren't delimited, but terminated by EOF.
parent 3cc1f7a6
......@@ -64,7 +64,10 @@ ssize_t getdelim(char** lineptr, size_t* n, int delim, FILE* fp)
int c;
do
{
if ( (c = getc(fp)) == EOF ) { goto cleanup; }
if ( (c = getc(fp)) == EOF )
{
if ( written ) { break; } else { goto cleanup; }
}
if ( bufsize <= (size_t) written + 1UL )
{
size_t newbufsize = 2UL * bufsize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment