aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/git-hooks/commit-msg
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2025-07-31 18:45:12 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2025-08-03 19:48:06 -0700
commit976f8abc19231ceea97b1ad90dd1da9bbfa30cea (patch)
treed74e02d74eab345a8c80025d16aea21fe71d2946 /scripts/git-hooks/commit-msg
parentmaint: prefer 'read' to 'safe_read' (diff)
downloadcoreutils-976f8abc19231ceea97b1ad90dd1da9bbfa30cea.tar.gz
coreutils-976f8abc19231ceea97b1ad90dd1da9bbfa30cea.zip
tail: record file offset more carefully
* src/tail.c (struct File_spec): New member read_pos, replacing size, since the value was really a read position not a size. All uses changed. (xlseek): Move defn up. (record_open_fd): If the read_pos (formerly) size arg is unknown, compute it here if it is a regular file. (file_lines): Return the resulting read pos (or -1 on failure) instead of storing it via a pointer. Caller changed. Simplify by using SEEK_CUR instead of SEEK_SET when that is easy. Avoid reading the same data twice when there are not enough lines in the file. (pipe_lines): Return -2 on success, -1 on failure, rather than updating a read pos via a pointer (which was weird for pipes anyway). Caller changed. (pipe_bytes, tail_bytes, tail_lines, tail): Return -1 on failure, a file offset if known, and < -1 otherwise, instead of storing a file offset via a pointer. Caller changed. (pipe_bytes): Take initial file offset as an arg, or -1 if unknown. (start_bytes, start_lines): Return -1 (not 1) on error, -2 (not -1) on EOF, and do not accept pointer to read pos as an arg since neither we nor our caller know the read pos. Callers changed. (recheck): Do not assume a newly-opened file is at offset zero, as this is not always true on Solaris. (tail_forever, check_fspec): Use dump_remainder result only on regular files, to prevent (very unlikely) overflow. (tail_file): Remove no-longer-needed TAIL_TEST_SLEEP code.
Diffstat (limited to 'scripts/git-hooks/commit-msg')
0 files changed, 0 insertions, 0 deletions