signal: keep waiting for process to exit on SIGQUIT

the SA_RESTART flag causes syscalls such as waitpid to be resumed after a signal
is handled, which is what we want.
This commit is contained in:
Khaïs COLIN 2025-04-04 14:25:39 +02:00
parent f0145d26f4
commit 67b2347df9
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo

View file

@ -6,11 +6,12 @@
/* By: jguelen <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/20 10:26:05 by jguelen #+# #+# */
/* Updated: 2025/02/21 17:02:33 by jguelen ### ########.fr */
/* Updated: 2025/04/04 14:25:35 by khais ### ########.fr */
/* */
/* ************************************************************************** */
#include "sig.h"
#include "signal.h"
/*
** g_signum exists to store the value of a signal if relevant for later
@ -53,6 +54,7 @@ int set_interactive_mode_sig_handling(void)
ft_bzero(&sig_act, sizeof(struct sigaction));
sig_act.sa_handler = &sig_interactive;
sig_act.sa_flags |= SA_RESTART;
if (sigemptyset(&sig_act.sa_mask) == -1)
return (-1);
if (sigaction(SIGINT, &sig_act, NULL) == -1)