🔨」 fix(exec/exec_cmd): fixed sigpipe leaks when forked :D

This commit is contained in:
y-syo
2024-08-13 18:41:46 +02:00
parent c16d60bf1c
commit 0095e89db4
5 changed files with 43 additions and 8 deletions

33
src/exec/sigpipe.c Normal file
View File

@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sigpipe.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/13 18:23:24 by mmoussou #+# #+# */
/* Updated: 2024/08/13 18:40:19 by mmoussou ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
#include "builtins.h"
char **get_env_arr(char **env)
{
static char **ret;
if (env)
ret = env;
return (ret);
}
void sig_p(int code)
{
t_env **env;
(void) code;
env = get_env(NULL);
free_exit(*env, get_env_arr(NULL));
exit(141);
}