dovecot-2.0: master: Fix to previous change, don't crash at serv...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 30 20:09:26 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/907e781f7999
changeset: 9955:907e781f7999
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 30 13:09:18 2009 -0400
description:
master: Fix to previous change, don't crash at service deinit.

diffstat:

1 file changed, 12 insertions(+), 6 deletions(-)
src/master/service-anvil.c |   18 ++++++++++++------

diffs (49 lines):

diff -r c998a51b7be4 -r 907e781f7999 src/master/service-anvil.c
--- a/src/master/service-anvil.c	Wed Sep 30 13:03:07 2009 -0400
+++ b/src/master/service-anvil.c	Wed Sep 30 13:09:18 2009 -0400
@@ -14,6 +14,15 @@
 #define ANVIL_HANDSHAKE "VERSION\tanvil\t1\t0\n"
 
 static void
+service_list_anvil_discard_input_stop(struct service_list *service_list)
+{
+	if (service_list->anvil_io_blocking != NULL) {
+		io_remove(&service_list->anvil_io_blocking);
+		io_remove(&service_list->anvil_io_nonblocking);
+	}
+}
+
+static void
 anvil_input_fd_discard(struct service_list *service_list, int fd)
 {
 	char buf[1024];
@@ -22,8 +31,7 @@ anvil_input_fd_discard(struct service_li
 	ret = read(fd, buf, sizeof(buf));
 	if (ret <= 0) {
 		i_error("read(anvil fd) failed: %m");
-		io_remove(&service_list->anvil_io_blocking);
-		io_remove(&service_list->anvil_io_nonblocking);
+		service_list_anvil_discard_input_stop(service_list);
 	}
 }
 
@@ -118,6 +126,7 @@ int service_list_init_anvil(struct servi
 
 void service_list_deinit_anvil(struct service_list *service_list)
 {
+	service_list_anvil_discard_input_stop(service_list);
 	service_process_notify_deinit(&service_list->anvil_kills);
 	if (close(service_list->blocking_anvil_fd[0]) < 0)
 		i_error("close(anvil) failed: %m");
@@ -131,10 +140,7 @@ void service_list_deinit_anvil(struct se
 
 void service_anvil_process_created(struct service *service)
 {
-	if (service->list->anvil_io_blocking != NULL) {
-		io_remove(&service->list->anvil_io_blocking);
-		io_remove(&service->list->anvil_io_nonblocking);
-	}
+	service_list_anvil_discard_input_stop(service->list);
 }
 
 void service_anvil_process_destroyed(struct service *service)


More information about the dovecot-cvs mailing list