[dovecot-cvs] dovecot/src/deliver deliver.c,1.7,1.8

cras at dovecot.org cras at dovecot.org
Sun Sep 25 14:07:38 EEST 2005


Update of /var/lib/cvs/dovecot/src/deliver
In directory talvi:/tmp/cvs-serv8918/deliver

Modified Files:
	deliver.c 
Log Message:
Implemented new signal handling framework, which makes handling signals much
easier.



Index: deliver.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/deliver/deliver.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- deliver.c	23 May 2005 19:51:38 -0000	1.7
+++ deliver.c	25 Sep 2005 11:07:36 -0000	1.8
@@ -38,8 +38,12 @@
 static struct ioloop *ioloop;
 static int return_value = EX_SOFTWARE;
 
-static void sig_quit(int signo __attr_unused__)
+static void sig_die(int signo, void *context __attr_unused__)
 {
+	/* warn about being killed because of some signal, except SIGINT (^C)
+	   which is too common at least while testing :) */
+	if (signo != SIGINT)
+		i_warning("Killed with signal %d", signo);
 	io_loop_stop(ioloop);
 }
 
@@ -349,7 +353,10 @@
 	const char *str;
 
 	lib_init();
-	lib_init_signals(sig_quit);
+	lib_signals_init();
+        lib_signals_set_handler(SIGINT, TRUE, sig_die, NULL);
+        lib_signals_set_handler(SIGTERM, TRUE, sig_die, NULL);
+        lib_signals_set_handler(SIGPIPE, FALSE, NULL, NULL);
 	ioloop = io_loop_create(default_pool);
 
 	destination = NULL;
@@ -453,6 +460,7 @@
         mail_storage_destroy(storage);
         mail_storage_deinit();
 	io_loop_destroy(ioloop);
+	lib_signals_deinit();
 	lib_deinit();
 
         return EX_OK;



More information about the dovecot-cvs mailing list