]> git.ipfire.org Git - thirdparty/coreutils.git/commit
maint: prefer 'read' to 'safe_read'
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 31 Jul 2025 19:31:58 +0000 (12:31 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 4 Aug 2025 02:48:05 +0000 (19:48 -0700)
commitd3c7072a0950c57c52a4e1856109d084a6d09593
tree0aa37cedbc0c950b2d2c33d0ef7126becfe184d3
parent382044766789d961fd8124dd7f8a0a06058da20a
maint: prefer 'read' to 'safe_read'

In the old days, safe_read acted more like what full_read does now.
When that went away, some code that invoked safe_read should
have gone back to plain 'read' but I guess we never got around to it.
Simplify this code by going back to plain 'read'.
Use safe_read only in csplit.c, which has a signal handler
and where 'read' can therefore fail with EINTR.
Although safe_read also checks for oversize buffers,
that is better done via io_blksize.
* src/cat.c (simple_cat, cat):
* src/head.c (copy_fd, elide_tail_lines_pipe)
* src/tac.c (tac_seekable, copy_to_temp):
(elide_tail_lines_seekable, head_lines):
* src/tail.c (dump_remainder, file_lines, pipe_lines)
(pipe_bytes, start_bytes, start_lines, tail_forever_inotify):
* src/tr.c (plain_read):
Use plain 'read', not safe_read, since there is no
need to worry about signals or oversize requests.
Also, there is no longer a need to include safe-read.h.
* src/ioblksize.h: Include sys-limits.h, for SYS_BUFSIZE_MAX.
(io_blksize): Max out at SYS_BUFSIZE_MAX.
src/cat.c
src/head.c
src/ioblksize.h
src/tac.c
src/tail.c
src/tr.c