Skip to content

Commit

Permalink
Correct some inconsistent function call conventions in CRT.c
Browse files Browse the repository at this point in the history
  • Loading branch information
natoscott authored and BenBE committed Apr 5, 2023
1 parent 14da84f commit c878343
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions CRT.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,16 +888,16 @@ static struct sigaction old_sig_handler[32];

static void CRT_installSignalHandlers(void) {
struct sigaction act;
sigemptyset (&act.sa_mask);
sigemptyset(&act.sa_mask);
act.sa_flags = (int)SA_RESETHAND | SA_NODEFER;
act.sa_handler = CRT_handleSIGSEGV;
sigaction (SIGSEGV, &act, &old_sig_handler[SIGSEGV]);
sigaction (SIGFPE, &act, &old_sig_handler[SIGFPE]);
sigaction (SIGILL, &act, &old_sig_handler[SIGILL]);
sigaction (SIGBUS, &act, &old_sig_handler[SIGBUS]);
sigaction (SIGPIPE, &act, &old_sig_handler[SIGPIPE]);
sigaction (SIGSYS, &act, &old_sig_handler[SIGSYS]);
sigaction (SIGABRT, &act, &old_sig_handler[SIGABRT]);
sigaction(SIGSEGV, &act, &old_sig_handler[SIGSEGV]);
sigaction(SIGFPE, &act, &old_sig_handler[SIGFPE]);
sigaction(SIGILL, &act, &old_sig_handler[SIGILL]);
sigaction(SIGBUS, &act, &old_sig_handler[SIGBUS]);
sigaction(SIGPIPE, &act, &old_sig_handler[SIGPIPE]);
sigaction(SIGSYS, &act, &old_sig_handler[SIGSYS]);
sigaction(SIGABRT, &act, &old_sig_handler[SIGABRT]);

signal(SIGCHLD, SIG_DFL);
signal(SIGINT, CRT_handleSIGTERM);
Expand All @@ -906,13 +906,13 @@ static void CRT_installSignalHandlers(void) {
}

void CRT_resetSignalHandlers(void) {
sigaction (SIGSEGV, &old_sig_handler[SIGSEGV], NULL);
sigaction (SIGFPE, &old_sig_handler[SIGFPE], NULL);
sigaction (SIGILL, &old_sig_handler[SIGILL], NULL);
sigaction (SIGBUS, &old_sig_handler[SIGBUS], NULL);
sigaction (SIGPIPE, &old_sig_handler[SIGPIPE], NULL);
sigaction (SIGSYS, &old_sig_handler[SIGSYS], NULL);
sigaction (SIGABRT, &old_sig_handler[SIGABRT], NULL);
sigaction(SIGSEGV, &old_sig_handler[SIGSEGV], NULL);
sigaction(SIGFPE, &old_sig_handler[SIGFPE], NULL);
sigaction(SIGILL, &old_sig_handler[SIGILL], NULL);
sigaction(SIGBUS, &old_sig_handler[SIGBUS], NULL);
sigaction(SIGPIPE, &old_sig_handler[SIGPIPE], NULL);
sigaction(SIGSYS, &old_sig_handler[SIGSYS], NULL);
sigaction(SIGABRT, &old_sig_handler[SIGABRT], NULL);

signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
Expand Down Expand Up @@ -1225,7 +1225,7 @@ void CRT_handleSIGSEGV(int signal) {
);

/* Call old sigsegv handler; may be default exit or third party one (e.g. ASAN) */
if (sigaction (signal, &old_sig_handler[signal], NULL) < 0) {
if (sigaction(signal, &old_sig_handler[signal], NULL) < 0) {
/* This avoids an infinite loop in case the handler could not be reset. */
fprintf(stderr,
"!!! Chained handler could not be restored. Forcing exit.\n"
Expand Down

0 comments on commit c878343

Please sign in to comment.