mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
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:
parent
f0145d26f4
commit
67b2347df9
1 changed files with 3 additions and 1 deletions
|
|
@ -6,11 +6,12 @@
|
||||||
/* By: jguelen <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jguelen <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/20 10:26:05 by jguelen #+# #+# */
|
/* 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 "sig.h"
|
||||||
|
#include "signal.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** g_signum exists to store the value of a signal if relevant for later
|
** 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));
|
ft_bzero(&sig_act, sizeof(struct sigaction));
|
||||||
sig_act.sa_handler = &sig_interactive;
|
sig_act.sa_handler = &sig_interactive;
|
||||||
|
sig_act.sa_flags |= SA_RESTART;
|
||||||
if (sigemptyset(&sig_act.sa_mask) == -1)
|
if (sigemptyset(&sig_act.sa_mask) == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
if (sigaction(SIGINT, &sig_act, NULL) == -1)
|
if (sigaction(SIGINT, &sig_act, NULL) == -1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue