From d7bb74a7a46bd87d48eeea50025a6007cdfeb732 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 4 Jan 2007 00:24:50 +0100 Subject: inotail.c: Fix an off-by-one error in lines_to_offset_from_end() buf[block_size] is obviously _not_ in buf itself. --- inotail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 */ -- cgit v1.2.3-54-g00ecf