Save the registry before exiting on a SIGTERM.

This commit is contained in:
Alexandre Julliard 2001-12-26 23:11:49 +00:00
parent d0642b5387
commit 839dfda7a9
1 changed files with 14 additions and 0 deletions

View File

@ -208,6 +208,13 @@ static void sighup_handler()
#endif
}
/* SIGTERM handler */
static void sigterm_handler()
{
close_registry();
exit(1);
}
/* server main loop */
void select_loop(void)
{
@ -219,6 +226,9 @@ void select_loop(void)
sigemptyset( &sigset );
sigaddset( &sigset, SIGCHLD );
sigaddset( &sigset, SIGHUP );
sigaddset( &sigset, SIGINT );
sigaddset( &sigset, SIGQUIT );
sigaddset( &sigset, SIGTERM );
sigprocmask( SIG_BLOCK, &sigset, NULL );
/* set the handlers */
@ -228,6 +238,10 @@ void select_loop(void)
sigaction( SIGCHLD, &action, NULL );
action.sa_handler = sighup_handler;
sigaction( SIGHUP, &action, NULL );
action.sa_handler = sigterm_handler;
sigaction( SIGINT, &action, NULL );
sigaction( SIGQUIT, &action, NULL );
sigaction( SIGTERM, &action, NULL );
while (active_users)
{