diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2007-01-04 00:24:50 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@xenon.tklauser.home> | 2007-01-04 00:24:50 +0100 |
commit | d7bb74a7a46bd87d48eeea50025a6007cdfeb732 (patch) | |
tree | 9633ffb1d44cf06012fc997d9758739e4ba2ef5e | |
parent | 27123737d374bbdf56785a76701d7d3353a82bb0 (diff) |
inotail.c: Fix an off-by-one error in lines_to_offset_from_end()
buf[block_size] is obviously _not_ in buf itself.
-rw-r--r-- | inotail.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 */ |