mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Work around a getdelim bug in column(1).
This commit is contained in:
parent
06cfd44323
commit
9c2f89d56c
1 changed files with 5 additions and 0 deletions
|
@ -96,11 +96,16 @@ bool append_lines_from_file(FILE* fp,
|
||||||
{
|
{
|
||||||
char* string = NULL;
|
char* string = NULL;
|
||||||
size_t string_size;
|
size_t string_size;
|
||||||
|
errno = 0;
|
||||||
ssize_t string_length = getline(&string, &string_size, fp);
|
ssize_t string_length = getline(&string, &string_size, fp);
|
||||||
if ( string_length < 0 )
|
if ( string_length < 0 )
|
||||||
{
|
{
|
||||||
if ( feof(stdin) )
|
if ( feof(stdin) )
|
||||||
return true;
|
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);
|
error(0, errno, "getline: `%s'", fpname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue