diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2008-03-24 19:59:33 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@xenon.tklauser.home> | 2008-03-24 19:59:33 +0100 |
commit | 14acc093e702688e9680415e51d53794e075475b (patch) | |
tree | cd0e078ff42d385a9c7b7d7efeacbdc342c008ae | |
parent | ce6f9f6dab399a907f9f623f1986870df34f4663 (diff) |
Prevent double calls to ignore_file() in/after tail_file()
-rw-r--r-- | inotail.c | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -490,20 +490,17 @@ static int tail_file(struct file_struct *f, unsigned long n_units, mode_t mode, f->fd = open(f->name, O_RDONLY); if (unlikely(f->fd < 0)) { fprintf(stderr, "Error: Could not open file '%s' (%s)\n", f->name, strerror(errno)); - ignore_file(f); return -1; } } if (fstat(f->fd, &finfo) < 0) { fprintf(stderr, "Error: Could not stat file '%s' (%s)\n", f->name, strerror(errno)); - ignore_file(f); return -1; } if (!IS_TAILABLE(finfo.st_mode)) { fprintf(stderr, "Error: '%s' of unsupported file type (%s)\n", f->name, strerror(errno)); - ignore_file(f); return -1; } @@ -527,10 +524,8 @@ static int tail_file(struct file_struct *f, unsigned long n_units, mode_t mode, offset = bytes_to_offset(f, n_units); /* We only get negative offsets on errors */ - if (unlikely(offset < 0)) { - ignore_file(f); + if (unlikely(offset < 0)) return -1; - } if (lseek(f->fd, offset, SEEK_SET) == (off_t) -1) { fprintf(stderr, "Error: Could not seek in file '%s' (%s)\n", f->name, strerror(errno)); |