}
void sigbus_install(void) {
- struct sigaction sa = {
+ static const struct sigaction sa = {
.sa_sigaction = sigbus_handler,
.sa_flags = SA_SIGINFO,
};
}
_noreturn_ static void crash(int sig, siginfo_t *siginfo, void *context) {
- struct sigaction sa;
+ static const struct sigaction sa_nocldwait = {
+ .sa_handler = SIG_IGN,
+ .sa_flags = SA_NOCLDSTOP|SA_NOCLDWAIT|SA_RESTART,
+ };
+
pid_t pid;
+ int r;
/* NB: 💣 💣 💣 This is a signal handler, most likely executed in a situation where we have corrupted
* memory. Thus: please avoid any libc memory allocation here, or any functions that internally use
_exit(EXIT_EXCEPTION);
} else {
siginfo_t status;
- int r;
if (siginfo) {
if (siginfo->si_pid == 0)
if (arg_crash_chvt >= 0)
(void) chvt(arg_crash_chvt);
- sa = (struct sigaction) {
- .sa_handler = SIG_IGN,
- .sa_flags = SA_NOCLDSTOP|SA_NOCLDWAIT|SA_RESTART,
- };
-
/* Let the kernel reap children for us */
- (void) sigaction(SIGCHLD, &sa, NULL);
+ (void) sigaction(SIGCHLD, &sa_nocldwait, NULL);
if (arg_crash_shell) {
log_notice("Executing crash shell...");
#define RTSIG_IF_AVAILABLE(signum) (signum <= SIGRTMAX ? signum : -1)
static int manager_setup_signals(Manager *m) {
- struct sigaction sa = {
+ static const struct sigaction sa = {
.sa_handler = SIG_DFL,
.sa_flags = SA_NOCLDSTOP|SA_RESTART,
};
}
static int run_debug(int argc, char **argv, void *userdata) {
- _cleanup_(sd_journal_closep) sd_journal *j = NULL;
- _cleanup_free_ char *exe = NULL, *path = NULL;
- _cleanup_strv_free_ char **debugger_call = NULL;
- struct sigaction sa = {
+ static const struct sigaction sa = {
.sa_sigaction = sigterm_handler,
.sa_flags = SA_SIGINFO,
};
+
+ _cleanup_(sd_journal_closep) sd_journal *j = NULL;
+ _cleanup_free_ char *exe = NULL, *path = NULL;
+ _cleanup_strv_free_ char **debugger_call = NULL;
bool unlink_path = false;
const char *data, *fork_name;
size_t len;