Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5940:b985e2127a2d HEAD
Listen for IN_DELETE_SELF too. Ignore EINVAL for inotify_rm_watch().
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 09 Jul 2007 07:31:28 +0300 |
parents | 8f1d94246a8f |
children | 90de57daa0d4 |
files | src/lib/ioloop-notify-inotify.c |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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 @@ 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"); }