FYI, as far as I can see this really is inconsequential. I reviewed the code and also ran strace before and after, exercising the affected code. There was no difference in syscalls, and there was no difference in output when I used this as input to the tail'd fifo "f": (seq 10; sleep 1; echo foo) > f
I tested both with and without ---disable-inotify. >From e7b4bf4b57efb699c87f03c1173d812ea34cb618 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Wed, 1 Jun 2011 13:48:12 +0200 Subject: [PATCH] tail: fix an inconsequential bug spotted by coverity * src/tail.c (start_bytes): Increase *READ_POS (not READ_POS) by the number of bytes read. This is a real bug that happens to have no consequence in practice. First, this code is exercised only when tailing-forever a non-regular file by bytes, and with a start-relative offset, e.g., "mkfifo f; tail -f -c +3 f", but even then, the invalid READ_POS value does not influence how tail works. It is stored in the File_spec.size member, but that member is not used at all in tail_forever_inotify, and in tail_forever, it is used only when the File_spec refers to a regular file. --- src/tail.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/tail.c b/src/tail.c index 714e278..f315776 100644 --- a/src/tail.c +++ b/src/tail.c @@ -818,7 +818,7 @@ start_bytes (const char *pretty_filename, int fd, uintmax_t n_bytes, error (0, errno, _("error reading %s"), quote (pretty_filename)); return 1; } - read_pos += bytes_read; + *read_pos += bytes_read; if (bytes_read <= n_bytes) n_bytes -= bytes_read; else -- 1.7.5.3.716.g40fa6
