[dovecot-cvs] dovecot/src/pop3 main.c,1.41,1.42

cras at dovecot.org cras at dovecot.org
Sun Apr 9 17:48:25 EEST 2006


Update of /var/lib/cvs/dovecot/src/pop3
In directory talvi:/tmp/cvs-serv14990/pop3

Modified Files:
	main.c 
Log Message:
When master dies (by closing log file descriptor), kill ourself also.



Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/pop3/main.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- main.c	26 Feb 2006 12:16:19 -0000	1.41
+++ main.c	9 Apr 2006 14:48:23 -0000	1.42
@@ -39,6 +39,8 @@
 
 static struct module *modules;
 static char log_prefix[128]; /* syslog() needs this to be permanent */
+static struct io *log_io = NULL;
+
 enum client_workarounds client_workarounds = 0;
 bool enable_last_command = FALSE;
 bool no_flag_updates = FALSE;
@@ -55,6 +57,11 @@
 	io_loop_stop(ioloop);
 }
 
+static void log_error_callback(void *context __attr_unused__)
+{
+	io_loop_stop(ioloop);
+}
+
 static void parse_workarounds(void)
 {
         struct client_workaround_list *list;
@@ -168,6 +175,12 @@
 		       dec2str(geteuid()), dec2str(getegid()));
 	}
 
+	if (getenv("LOG_TO_MASTER") != NULL) {
+		/* If master dies, the log fd gets closed and we'll quit */
+		log_io = io_add(STDERR_FILENO, IO_ERROR,
+				log_error_callback, NULL);
+	}
+
 	dict_client_register();
         mail_storage_init();
 	mail_storage_register_all();
@@ -232,6 +245,8 @@
 
 static void main_deinit(void)
 {
+	if (log_io != NULL)
+		io_remove(&log_io);
 	module_dir_unload(&modules);
 
 	clients_deinit();



More information about the dovecot-cvs mailing list