dovecot: Listen for IN_DELETE_SELF too. Ignore EINVAL for inotif...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jul 9 07:31:35 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/b985e2127a2d
changeset: 5940:b985e2127a2d
user: Timo Sirainen <tss at iki.fi>
date: Mon Jul 09 07:31:28 2007 +0300
description:
Listen for IN_DELETE_SELF too. Ignore EINVAL for inotify_rm_watch().
diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
src/lib/ioloop-notify-inotify.c | 9 ++++++---
diffs (26 lines):
diff -r 8f1d94246a8f -r b985e2127a2d src/lib/ioloop-notify-inotify.c
--- a/src/lib/ioloop-notify-inotify.c Mon Jul 09 07:04:51 2007 +0300
+++ b/src/lib/ioloop-notify-inotify.c Mon Jul 09 07:31:28 2007 +0300
@@ -98,8 +98,8 @@ enum io_notify_result io_add_notify(cons
return IO_NOTIFY_DISABLED;
wd = inotify_add_watch(ctx->inotify_fd, path,
- IN_CREATE | IN_DELETE | IN_MOVE |
- IN_CLOSE | IN_MODIFY);
+ IN_CREATE | IN_DELETE | IN_DELETE_SELF |
+ IN_MOVE | IN_CLOSE | IN_MODIFY);
if (wd < 0) {
if (errno == ENOENT)
return IO_NOTIFY_NOTFOUND;
@@ -128,7 +128,10 @@ void io_loop_notify_remove(struct ioloop
struct io_notify *io = (struct io_notify *)_io;
if (io->fd != -1) {
- if (inotify_rm_watch(ctx->inotify_fd, io->fd) < 0)
+ /* ernro=EINVAL happens if the file itself is deleted and
+ kernel has sent IN_IGNORED event which we haven't read. */
+ if (inotify_rm_watch(ctx->inotify_fd, io->fd) < 0 &&
+ errno != EINVAL)
i_error("inotify_rm_watch() failed: %m");
}
More information about the dovecot-cvs
mailing list