Work around a getdelim bug in column(1).

This commit is contained in:
Jonas 'Sortie' Termansen 2014-12-28 15:51:49 +01:00
parent 06cfd44323
commit 9c2f89d56c
1 changed files with 5 additions and 0 deletions

View File

@ -96,11 +96,16 @@ bool append_lines_from_file(FILE* fp,
{
char* string = NULL;
size_t string_size;
errno = 0;
ssize_t string_length = getline(&string, &string_size, fp);
if ( string_length < 0 )
{
if ( feof(stdin) )
return true;
// TODO: HACK: Unfortunately feof(stdin) isn't always true in the
// normal EOF case due to a getline/getdelim bug.
if ( errno == 0 )
return true;
error(0, errno, "getline: `%s'", fpname);
return false;
}