summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2006-08-20 18:03:37 +0200
committerTobias Klauser <tklauser@xenon.tklauser.home>2006-08-20 18:03:37 +0200
commit3b0d7556897bd0fb296081ae5b4d4866409e7d2f (patch)
treec5d2a77b4ed1db55d7a2a27fa0c33a5b7a2355ff
parent0f43e35184fb9c39229abee6782fe9a707849ba8 (diff)
Cleanup
-rw-r--r--inotail.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/inotail.c b/inotail.c
index afcc1f7..c7c20c8 100644
--- a/inotail.c
+++ b/inotail.c
@@ -37,9 +37,9 @@
#include "inotail.h"
-#define PROGRAM_NAME "inotail"
+#define PROGRAM_NAME "inotail"
#ifndef VERSION
-#define VERSION "undef"
+# define VERSION "undef"
#endif
#define BUFFER_SIZE 4096
@@ -213,20 +213,21 @@ static int watch_files(struct file_struct *f, int n_files)
offset = fil->st_size;
- dprintf(" File '%s' modified.\n", fil->name);
- dprintf(" offset: %lu.\n", offset);
+ dprintf(" File '%s' modified, offset: %lu.\n", fil->name, offset);
fil->fd = open(fil->name, O_RDONLY);
if (fil->fd < 0) {
fil->ignore = 1;
n_ignored++;
fprintf(stderr, "Error: Could not open file '%s' (%s)\n", f->name, strerror(errno));
+ continue;
}
if (fstat(fil->fd, &finfo) < 0) {
fil->ignore = 1;
n_ignored++;
fprintf(stderr, "Error: Could not stat file '%s' (%s)\n", f->name, strerror(errno));
+ continue;
}
fil->st_size = finfo.st_size;
@@ -252,20 +253,16 @@ static int watch_files(struct file_struct *f, int n_files)
}
close(fil->fd);
- }
-
- if (inev->mask & IN_DELETE_SELF) {
+ } else if (inev->mask & IN_DELETE_SELF) {
fil->ignore = 1;
n_ignored++;
fprintf(stderr, "File '%s' deleted.\n", fil->name);
- }
- if (inev->mask & IN_MOVE_SELF) {
+ } else if (inev->mask & IN_MOVE_SELF) {
fil->ignore = 1;
n_ignored++;
fprintf(stderr, "File '%s' moved.\n", fil->name);
/* TODO: Try to follow file/fd */
- }
- if (inev->mask & IN_UNMOUNT) {
+ } else if (inev->mask & IN_UNMOUNT) {
fil->ignore = 1;
n_ignored++;
fprintf(stderr, "Device containing file '%s' unmounted.\n", fil->name);