- act.sa_handler = SIG_IGN;
- sigaction(SIGTSTP, &act, &oact);
- } else if (act.sa_handler != SIG_DFL) {
- sigaction(SIGTSTP, &oact, NULL);
- } else if (sigaction(SIGTSTP, NULL, &oact) == 0
- && (oact.sa_handler == SIG_DFL)) {
- sigemptyset(&act.sa_mask);
+ new_sigaction.sa_handler = SIG_IGN;
+ sigaction(SIGTSTP, &new_sigaction, &old_sigaction);
+ } else if (new_sigaction.sa_handler != SIG_DFL) {
+ sigaction(SIGTSTP, &old_sigaction, NULL);
+ } else if (sigaction(SIGTSTP, NULL, &old_sigaction) == 0
+ && (old_sigaction.sa_handler == SIG_DFL)) {
+ sigemptyset(&new_sigaction.sa_mask);