msgr: fix sigint/term signal handler to actually quit (by chaining)

This commit is contained in:
Sage Weil 2010-04-29 21:12:16 -07:00
parent 96a90efcf2
commit 3480dc696d

View File

@ -2124,6 +2124,13 @@ static void remove_pid_file(int signal = 0)
}
}
static void handle_signal(int sig)
{
remove_pid_file(sig);
signal(sig, SIG_DFL);
kill(getpid(), sig);
}
static void write_pid_file(int pid)
{
if (!g_conf.pid_file)
@ -2136,8 +2143,8 @@ static void write_pid_file(int pid)
::write(fd, buf, len);
::close(fd);
signal(SIGTERM, remove_pid_file);
signal(SIGINT, remove_pid_file);
signal(SIGTERM, handle_signal);
signal(SIGINT, handle_signal);
}
}