From 9c2f89d56cee59dca6f5e29e448706e81ee05686 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 28 Dec 2014 15:51:49 +0100 Subject: [PATCH] Work around a getdelim bug in column(1). --- utils/column.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/column.cpp b/utils/column.cpp index 93138c78..000a6f29 100644 --- a/utils/column.cpp +++ b/utils/column.cpp @@ -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; }