Add check to make sure /run/initctl is open before we try to close
it when receiving SIGUSR1. Avoids crashing upon receiving signal.
This commit is contained in:
parent
aee28b3292
commit
f09da9cb55
@ -12,6 +12,12 @@ sysvinit (2.90) UNRELEASED; urgency=low
|
||||
longer waits if we slept past the time we should have shutdown.
|
||||
Accurate to the nearest minute.
|
||||
Closes Savannah bug #36279.
|
||||
* Added document article and manual page for the initctl (/run/initctl)
|
||||
named pipe. Makes it easier for people to communicate with and
|
||||
extend communication to init.
|
||||
* Added check that named pipe is open before trying to close it
|
||||
when something goes wrong or we receive SIGUSER1. Avoids potential
|
||||
crash if we receive SIGUSR1 while pipe is not open.
|
||||
|
||||
|
||||
sysvinit (2.89) world; urgency=low
|
||||
|
12
src/init.c
12
src/init.c
@ -2165,13 +2165,10 @@ void re_exec(void)
|
||||
initlog(L_CO, "Attempt to re-exec failed");
|
||||
}
|
||||
|
||||
/*
|
||||
* It's a backup day today, so I'm pissed off. Being a BOFH, however,
|
||||
* does have it's advantages...
|
||||
*/
|
||||
fail_cancel();
|
||||
close(pipe_fd);
|
||||
pipe_fd = -1;
|
||||
if (pipe_fd >= 0)
|
||||
close(pipe_fd);
|
||||
pipe_fd = -1;
|
||||
DELSET(got_signals, SIGCHLD);
|
||||
DELSET(got_signals, SIGHUP);
|
||||
DELSET(got_signals, SIGUSR1);
|
||||
@ -2680,7 +2677,8 @@ void process_signals()
|
||||
* SIGUSR1 means close and reopen /run/initctl
|
||||
*/
|
||||
INITDBG(L_VB, "got SIGUSR1");
|
||||
close(pipe_fd);
|
||||
if (pipe_fd)
|
||||
close(pipe_fd);
|
||||
pipe_fd = -1;
|
||||
DELSET(got_signals, SIGUSR1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user