diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-10 17:56:38 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-10 17:56:38 +0200 |
commit | 4b233e06a16bf5183223e8253b4d9ac9ee59e6a2 (patch) | |
tree | dc36a64dcad37e076f478aadc7cccb0f322ea192 /src/f_alloc.c | |
parent | pwd TODO done (diff) | |
download | 42-minishell-4b233e06a16bf5183223e8253b4d9ac9ee59e6a2.tar.gz 42-minishell-4b233e06a16bf5183223e8253b4d9ac9ee59e6a2.tar.bz2 42-minishell-4b233e06a16bf5183223e8253b4d9ac9ee59e6a2.tar.xz 42-minishell-4b233e06a16bf5183223e8253b4d9ac9ee59e6a2.tar.zst 42-minishell-4b233e06a16bf5183223e8253b4d9ac9ee59e6a2.zip |
Work in progress
Diffstat (limited to 'src/f_alloc.c')
-rw-r--r-- | src/f_alloc.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/f_alloc.c b/src/f_alloc.c index bfa75c3..62b7008 100644 --- a/src/f_alloc.c +++ b/src/f_alloc.c @@ -21,16 +21,20 @@ #include "s_struct.h" void - f_fail_alloc(t_msh *msh) + f_alloc_and_destroy_msh(t_msh *msh) { - ft_dprintf(STDERR_FILENO, "%s: %s\n", msh->shname, strerror(errno)); + char tmp[255]; + + lcom_clear(&msh->curr); + ft_strlcpy(tmp, msh->shname, ft_strlen(msh->shname) + 1); + s_destroy(msh); + ft_dprintf(STDERR_FILENO, "%s: %s\n", tmp, strerror(errno)); exit(FT_RET_ALLOC); } void - f_fail_alloc_and_destroy(t_msh *msh) + f_alloc_and_clear_lcom(t_msh *msh) { lcom_clear(&msh->curr); - s_destroy(msh); - f_fail_alloc(msh); + ft_dprintf(STDERR_FILENO, "%s: %s\n", msh->shname, strerror(errno)); } |