dovecot-2.2: Panic if io_remove() fails with EBADF.

dovecot at dovecot.org dovecot at dovecot.org
Thu Sep 26 06:51:54 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/86e59823d0aa
changeset: 16828:86e59823d0aa
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 26 05:51:43 2013 +0200
description:
Panic if io_remove() fails with EBADF.
It's a bug that shouldn't really be ignored. Panicing will give a debuggable
core dump.

diffstat:

 src/lib/ioloop-epoll.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r 83e74b3a0d10 -r 86e59823d0aa src/lib/ioloop-epoll.c
--- a/src/lib/ioloop-epoll.c	Thu Sep 26 04:55:59 2013 +0200
+++ b/src/lib/ioloop-epoll.c	Thu Sep 26 05:51:43 2013 +0200
@@ -143,8 +143,13 @@
 		op = last ? EPOLL_CTL_DEL : EPOLL_CTL_MOD;
 
 		if (epoll_ctl(ctx->epfd, op, io->fd, &event) < 0) {
-			i_error("epoll_ctl(%s, %d) failed: %m",
+			const char *errstr = t_strdup_printf(
+				"epoll_ctl(%s, %d) failed: %m",
 				op == EPOLL_CTL_DEL ? "del" : "mod", io->fd);
+			if (errno == EBADF)
+				i_panic("%s", errstr);
+			else
+				i_error("%s", errstr);
 		}
 	}
 	if (last) {


More information about the dovecot-cvs mailing list