diff options
-rw-r--r-- | simpletail.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/simpletail.c b/simpletail.c index fa47668..ec00b19 100644 --- a/simpletail.c +++ b/simpletail.c @@ -90,15 +90,15 @@ static off_t lines(int fd, int file_size, unsigned int n_lines) dprintf(" Found \\n at position %d\n", i); n_lines--; - if (n_lines == 0) + if (n_lines == 0) { + /* We don't want the first \n */ + offset += i + 1; break; + } } } } - if (n_lines == 0) - offset += i + 1; /* We don't want the first \n */ - return offset; } |