summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2006-12-28 13:49:08 +0100
committerTobias Klauser <tklauser@xenon.tklauser.home>2006-12-28 13:49:08 +0100
commit30477ae86b35b311362a20e3f9b83378744c3b4e (patch)
tree9c3f28f2f029dcfdf754e37c9d6af5f9d8ce0b96
parenteb8d45822da098061d3ffa27cc38504a20cd6187 (diff)
inotail.c: Handle return value of inotify_add_watch()
-rw-r--r--inotail.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/inotail.c b/inotail.c
index 6346ee5..1fa1645 100644
--- a/inotail.c
+++ b/inotail.c
@@ -335,10 +335,16 @@ static int watch_files(struct file_struct *f, int n_files)
}
for (i = 0; i < n_files; i++) {
- if (!f[i].ignore)
+ if (!f[i].ignore) {
f[i].i_watch = inotify_add_watch(ifd, f[i].name,
IN_MODIFY|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT);
- else
+
+ if (f[i].i_watch < 0) {
+ fprintf(stderr, "Error: Could not create inotify watch on file '%s' (%s)\n", f[i].name, strerror(errno));
+ f[i].ignore = 1;
+ n_ignored++;
+ }
+ } else
n_ignored++;
}