mirror of
https://github.com/ceph/ceph
synced 2025-01-15 23:43:06 +00:00
msgr: fix sigint/term signal handler to actually quit (by chaining)
This commit is contained in:
parent
96a90efcf2
commit
3480dc696d
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user