summaryrefslogtreecommitdiffstats
path: root/src/b_exit.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-30 20:30:58 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-30 20:30:58 +0200
commitc19bd35afdb45e49cebdfd96e7adb1e6fe477f0c (patch)
treec5a7655d5fa858da43b0c9e3f1f616d269aae172 /src/b_exit.c
parentWork in progress, freed leak (diff)
download42-minishell-c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c.tar.gz
42-minishell-c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c.tar.bz2
42-minishell-c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c.tar.xz
42-minishell-c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c.tar.zst
42-minishell-c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c.zip
Double exit no more
Diffstat (limited to 'src/b_exit.c')
-rw-r--r--src/b_exit.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/b_exit.c b/src/b_exit.c
index 777bbb9..5f1c446 100644
--- a/src/b_exit.c
+++ b/src/b_exit.c
@@ -28,10 +28,9 @@ uint8_t
uint8_t ret;
const uint64_t argc = get_argc((const char**)args);
- ret = 0;
if (argc > 1)
{
- fail_too_many_args("exit", msh);
+ f_fail_too_many_args("exit", msh);
return (1);
}
if (argc == 1)
@@ -39,7 +38,11 @@ uint8_t
ret = ft_atoi(args[0]);
/* TODO: non numeric args[0] */
}
+ else
+ ret = msh->ret;
ft_dprintf(STDERR_FILENO, "exit\n");
+ lcom_clear(&msh->curr);
+ s_destroy(msh);
exit(ret);
return (0);
}