]> git.ipfire.org Git - thirdparty/coreutils.git/commit
maint: don’t lseek memory objects
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 Jul 2025 23:41:05 +0000 (16:41 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 4 Aug 2025 02:48:04 +0000 (19:48 -0700)
commit938035b9b4b5913ec4919290117f14d99438be8c
tree8fc9aa557db7305a6cd7755b071aeacd27ae9a90
parentdfe4df56948294c4889b7201f7b6636b8ff01ea5
maint: don’t lseek memory objects

This affects behavior only on memory objects, which are not in Linux.
Formerly the code would use lseek on these objects,
but POSIX says the result of lseek is unspecified on them,
and in QNX lseek has undefined behavior on typed memory objects.
* src/head.c (elide_tail_bytes_file, elide_tail_lines_file):
Omit unnecessary uses of presume_input_pipe.
Improve some out-of-date comments.
(head): Do not assume a file is seekable merely because its
st_size is usable.  Instead, seek only on regular files.
* src/od.c (skip): Do not seek on memory objects.
src/head.c
src/od.c