mirror of
https://github.com/troglobit/finit.git
synced 2026-10-21 11:29:42 +00:00
Fix #51: Catching SIGSEGV not needed anymore
This patch fixes issue #51 by reverting b4b63d3, which is not needed
anymore since service callbacks have been removed from Finit3.
The `sig_unblock()` function, called for each forked off child, should
now be balanced with caught signals.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
b9ae4d04ef
commit
829ff0b9f7
2 files changed
+2
-14
No files matched your search
@@ -185,7 +185,7 @@ static int service_start(svc_t *svc)
|
|||||||
/* Declare we're waiting for svc to create its pidfile */
|
/* Declare we're waiting for svc to create its pidfile */
|
||||||
svc_starting(svc);
|
svc_starting(svc);
|
||||||
|
|
||||||
/* Block sigchild while forking. */
|
/* Block SIGCHLD while forking. */
|
||||||
sigemptyset(&nmask);
|
sigemptyset(&nmask);
|
||||||
sigaddset(&nmask, SIGCHLD);
|
sigaddset(&nmask, SIGCHLD);
|
||||||
sigprocmask(SIG_BLOCK, &nmask, &omask);
|
sigprocmask(SIG_BLOCK, &nmask, &omask);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ shutop_t halt = SHUT_DEFAULT;
|
|||||||
static int stopped = 0;
|
static int stopped = 0;
|
||||||
static uev_t sigterm_watcher, sigusr1_watcher, sigusr2_watcher;
|
static uev_t sigterm_watcher, sigusr1_watcher, sigusr2_watcher;
|
||||||
static uev_t sighup_watcher, sigint_watcher, sigpwr_watcher;
|
static uev_t sighup_watcher, sigint_watcher, sigpwr_watcher;
|
||||||
static uev_t sigchld_watcher, sigsegv_watcher;
|
static uev_t sigchld_watcher;
|
||||||
static uev_t sigstop_watcher, sigtstp_watcher, sigcont_watcher;
|
static uev_t sigstop_watcher, sigtstp_watcher, sigcont_watcher;
|
||||||
|
|
||||||
void mdadm_wait(void);
|
void mdadm_wait(void);
|
||||||
@@ -281,15 +281,6 @@ static void sigchld_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
|||||||
} while (pid > 0);
|
} while (pid > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SIGSEGV: mostly if service callbacks segfault
|
|
||||||
*/
|
|
||||||
static void sigsegv_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
|
||||||
{
|
|
||||||
_e("PID %d caused a segfault!\n", getpid());
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SIGSTOP/SIGTSTP: Paused by user or netflash
|
* SIGSTOP/SIGTSTP: Paused by user or netflash
|
||||||
*/
|
*/
|
||||||
@@ -393,9 +384,6 @@ void sig_setup(uev_ctx_t *ctx)
|
|||||||
/* After initial bootstrap of Finit we call the service monitor to reap children */
|
/* After initial bootstrap of Finit we call the service monitor to reap children */
|
||||||
uev_signal_init(ctx, &sigchld_watcher, sigchld_cb, NULL, SIGCHLD);
|
uev_signal_init(ctx, &sigchld_watcher, sigchld_cb, NULL, SIGCHLD);
|
||||||
|
|
||||||
/* Trap SIGSEGV in case service callbacks crash */
|
|
||||||
uev_signal_init(ctx, &sigsegv_watcher, sigsegv_cb, NULL, SIGSEGV);
|
|
||||||
|
|
||||||
/* Stopping init is a bit tricky. */
|
/* Stopping init is a bit tricky. */
|
||||||
uev_signal_init(ctx, &sigstop_watcher, sigstop_cb, NULL, SIGSTOP);
|
uev_signal_init(ctx, &sigstop_watcher, sigstop_cb, NULL, SIGSTOP);
|
||||||
uev_signal_init(ctx, &sigtstp_watcher, sigstop_cb, NULL, SIGTSTP);
|
uev_signal_init(ctx, &sigtstp_watcher, sigstop_cb, NULL, SIGTSTP);
|
||||||
|
|||||||
Reference in new issue
Block a user