Pádraig Brady wrote: > Ok to push this for the imminent release? > Subject: [PATCH] split: fix reporting of read errors > > The bug was introduced with commit 23f6d41f, 19-02-2003. > > * src/split.c (bytes_split, lines_split, line_bytes_split): > Correctly check the return from full_read(). > * NEWS: Mention the fix. ... > @@ -325,7 +325,7 @@ line_bytes_split (size_t n_bytes) > /* Fill up the full buffer size from the input file. */ > > n_read = full_read (STDIN_FILENO, buf + n_buffered, n_bytes - > n_buffered); > - if (n_read == SAFE_READ_ERROR) > + if (n_read < (n_bytes - n_buffered) && errno)
Yes, thanks! Good catch. How did you find it? However, I'd prefer to avoid parentheses like those in the final chunk, as well as the duplicated expression -- there are too many n_-prefixed names in the vicinity. What do you think of this instead? size_t n = n_bytes - n_buffered; n_read = full_read (STDIN_FILENO, buf + n_buffered, n); if (n_read < n && errno)