mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
ctdbd: Make sure we don't kill init process by mistake
If getpgrp() fails, it will return -1 and that will send KILL signal to init process (PID 1). This does not happen on RHEL, but does on AIX. Reported-by: Chris Cowan <cc@us.ibm.com> Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit edb2a3556d03e248b42f63dd2c62382b723bc98f)
This commit is contained in:
parent
27ba5b44b6
commit
d0c858f211
@ -34,8 +34,15 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
|
||||
*/
|
||||
static void sigterm(int sig)
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
/* all the child processes will be running in the same process group */
|
||||
kill(-getpgrp(), SIGKILL);
|
||||
pid = getpgrp();
|
||||
if (pid == -1) {
|
||||
kill(-getpid(), SIGKILL);
|
||||
} else {
|
||||
kill(-pid, SIGKILL);
|
||||
}
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user