summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2007-05-21 23:45:41 +0200
committerTobias Klauser <tklauser@xenon.tklauser.home>2007-05-21 23:45:41 +0200
commitec290fea4468a13a8019ce24b9bf2896f4725330 (patch)
treece1feae8914aa9111f632830237ffa1498d614e9
parent000fdf04a941b5d306c9c0cc54b9fce08b4379b8 (diff)
Some housekeeping after introduction of alloc_buffer()
-rw-r--r--inotail.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/inotail.c b/inotail.c
index 9d5229e..4664a62 100644
--- a/inotail.c
+++ b/inotail.c
@@ -142,7 +142,7 @@ static off_t lines_to_offset_from_end(struct file_struct *f, unsigned long n_lin
int i;
ssize_t rc, block_size = f->st_blksize; /* Size of the current block we're reading */
- if (offset < f->st_blksize)
+ if (offset < block_size)
block_size = offset;
/* Start of current block */
@@ -176,13 +176,12 @@ static off_t lines_to_offset_from_begin(struct file_struct *f, unsigned long n_l
char *buf;
off_t offset = 0;
- buf = alloc_buffer(f);
-
/* tail everything for 'inotail -n +0' */
if (n_lines == 0)
return 0;
n_lines--;
+ buf = alloc_buffer(f);
while (offset <= f->st_size && n_lines > 0) {
int i;