summaryrefslogtreecommitdiff
path: root/inotail.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2007-01-04 00:24:50 +0100
committerTobias Klauser <tklauser@xenon.tklauser.home>2007-01-04 00:24:50 +0100
commitd7bb74a7a46bd87d48eeea50025a6007cdfeb732 (patch)
tree9633ffb1d44cf06012fc997d9758739e4ba2ef5e /inotail.c
parent27123737d374bbdf56785a76701d7d3353a82bb0 (diff)
inotail.c: Fix an off-by-one error in lines_to_offset_from_end()
buf[block_size] is obviously _not_ in buf itself.
Diffstat (limited to 'inotail.c')
-rw-r--r--inotail.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/inotail.c b/inotail.c
index 3c17b38..3f08360 100644
--- a/inotail.c
+++ b/inotail.c
@@ -130,7 +130,7 @@ static off_t lines_to_offset_from_end(struct file_struct *f, unsigned int n_line
return -1;
}
- for (i = block_size; i > 0; i--) {
+ for (i = block_size - 1; i > 0; i--) {
if (buf[i] == '\n') {
if (--n_lines == 0)
return offset += i + 1; /* We don't want the first \n */