diff --git a/doc/Changelog b/doc/Changelog index 3e8f975..8d8c811 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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 diff --git a/src/init.c b/src/init.c index 4c785ce..feb384d 100644 --- a/src/init.c +++ b/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); }