[dovecot-cvs] dovecot/src/imap main.c,1.64,1.65
cras at dovecot.org
cras at dovecot.org
Sun Sep 25 14:07:40 EEST 2005
Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv8918/imap
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/imap/main.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- main.c 22 Jul 2005 14:20:44 -0000 1.64
+++ main.c 25 Sep 2005 11:07:36 -0000 1.65
@@ -50,8 +50,12 @@
string_t *capability_string;
-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);
}
@@ -130,7 +134,10 @@
struct client *client;
const char *user, *str;
- 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);
user = getenv("USER");
if (user == NULL) {
@@ -186,11 +193,6 @@
static void main_deinit(void)
{
- /* warn about being killed because of some signal, except SIGINT (^C)
- which is too common at least while testing :) */
- if (lib_signal_kill != 0 && lib_signal_kill != 2)
- i_warning("Killed with signal %d", lib_signal_kill);
-
module_dir_unload(modules);
commands_deinit();
@@ -201,6 +203,7 @@
str_free(capability_string);
+ lib_signals_deinit();
closelog();
}
More information about the dovecot-cvs
mailing list