void signal_int_handler(int signum) {
is_foreground ? kill_foreground_prcss() : signal(SIGINT, SIG_IGN);
}
...
struct sigaction sig_action;
sig_action.sa_flags = SA_RESTART;
sigemptyset(&sig_action.sa_mask);
sig_action.sa_handler = sig_child_handler;
manage_sig_action(&sig_action);
sig_action.sa_handler = signal_stop_handler;
sigaction(SIGTSTP, &sig_action, NULL);
sig_action.sa_handler = signal_quit_handler;
sigaction(SIGQUIT, &sig_action,NULL);
sig_action.sa_handler = signal_int_handler;
sigaction(SIGINT, &sig_action, NULL);
return sig_action;
Im trying to ignore ctrl+c if the process is not in the foreground but this is not working, would anyone be able to point me to why?