[dovecot-cvs] dovecot/src/login-common main.c,1.26,1.27
cras at dovecot.org
cras at dovecot.org
Sun Sep 25 14:07:41 EEST 2005
Update of /var/lib/cvs/dovecot/src/login-common
In directory talvi:/tmp/cvs-serv8918/login-common
Modified Files:
main.c
Log Message:
Implemented new signal handling framework, which makes handling signals much
easier.
Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/main.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- main.c 24 Sep 2005 12:25:25 -0000 1.26
+++ main.c 25 Sep 2005 11:07:39 -0000 1.27
@@ -74,8 +74,12 @@
master_notify_finished();
}
-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);
}
@@ -170,7 +174,10 @@
{
const char *value;
- 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);
disable_plaintext_auth = getenv("DISABLE_PLAINTEXT_AUTH") != NULL;
process_per_connection = getenv("PROCESS_PER_CONNECTION") != NULL;
@@ -238,9 +245,6 @@
static void main_deinit(void)
{
- if (lib_signal_kill != 0)
- i_warning("Killed with signal %d", lib_signal_kill);
-
if (io_listen != NULL) io_remove(io_listen);
if (io_ssl_listen != NULL) io_remove(io_ssl_listen);
@@ -251,6 +255,7 @@
clients_deinit();
master_deinit();
+ lib_signals_deinit();
closelog();
}
More information about the dovecot-cvs
mailing list