summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2008-08-31 21:34:16 +0200
committerTobias Klauser <tklauser@xenon.tklauser.home>2008-08-31 21:34:16 +0200
commitec2c7cba0e2a9f3f4c15119525fa16d1a359a6b2 (patch)
tree656503671dca083c3f695167465065c2b886ac9c
parent164d300c2d4d88f2bd787a0c56dc34b3ebb47073 (diff)
Check for file being a pipe before seeking
Otherwise inotail -f on a named pipe (fifo) would not work. Thanks Alexander Sulfrian.
-rw-r--r--inotail.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/inotail.c b/inotail.c
index d708f1f..62920ba 100644
--- a/inotail.c
+++ b/inotail.c
@@ -591,7 +591,7 @@ static int handle_inotify_event(struct inotify_event *inev, struct file_struct *
}
/* Seek to old file size */
- if ((ret = lseek(f->fd, f->size, SEEK_SET)) == (off_t) -1) {
+ if (!IS_PIPELIKE(finfo.st_mode) && (ret = lseek(f->fd, f->size, SEEK_SET)) == (off_t) -1) {
fprintf(stderr, "Error: Could not seek in file '%s' (%s)\n", f->name, strerror(errno));
goto ignore;
}