On 24.08.2016 18:33, Ingo Schwarze wrote: > 2. The stdio read buffer is not empty at the time of the call > or the first __refill() succeeds, but then a subsequent __refill() > fails: > fgetln(3) returns a buffer containing the concatenation of all > strings that were returned by the __refill() calls before the > failing one, but it sets errno and the stdio error indicator > anyway. There is a comment in the source code saying: > /* EOF or error: return partial line */ > > This is problematic in two ways. >
Yes, it is a bit problematic, but it is the way this function designed in BSD 44lite, so I disagree with the patch. I.e. preserving partial line is more essential for it than returning no line at all (NULL), so tail error on partial line is not treated as error. Since this function usually used in the loop, it returns partial line on the first pass and returns NULL with error on the second pass, so uncatched error on the first pass is not a big deal.
