From 6737f1ad17b78496e86dde8b97a531d171f79213 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 11 Feb 2008 18:23:40 +0100 Subject: inotail.c: Check ignore flag before ignoreing the file This makes ignore_file reentrant. Calling the function on a file which is already ignored shouldn't lead to n_ignored getting incremented. --- inotail.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inotail.c b/inotail.c index fcf9185..aa11a8c 100644 --- a/inotail.c +++ b/inotail.c @@ -105,8 +105,10 @@ static void ignore_file(struct file_struct *f) close(f->fd); f->fd = -1; } - f->ignore = 1; - n_ignored++; + if (!f->ignore) { + f->ignore = 1; + n_ignored++; + } } static inline char *pretty_name(char *filename) -- cgit v1.2.3-54-g00ecf