summaryrefslogtreecommitdiffstats
path: root/src/f_alloc.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-12-12 16:50:46 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-12-12 16:50:46 +0100
commit7d0d45b09ad2beb677ed1a22d37db1e40786519e (patch)
tree401b33b030a94c1dabac695c0ec188c7d9de43d8 /src/f_alloc.c
parentRemoved bloatcode (diff)
download42-minishell-7d0d45b09ad2beb677ed1a22d37db1e40786519e.tar.gz
42-minishell-7d0d45b09ad2beb677ed1a22d37db1e40786519e.tar.bz2
42-minishell-7d0d45b09ad2beb677ed1a22d37db1e40786519e.tar.xz
42-minishell-7d0d45b09ad2beb677ed1a22d37db1e40786519e.tar.zst
42-minishell-7d0d45b09ad2beb677ed1a22d37db1e40786519e.zip
Securing mallocs
Diffstat (limited to '')
-rw-r--r--src/f_alloc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/f_alloc.c b/src/f_alloc.c
index dc3f589..5f42f09 100644
--- a/src/f_alloc.c
+++ b/src/f_alloc.c
@@ -10,16 +10,24 @@
/* */
/* ************************************************************************** */
+#include <errno.h>
#include <libft.h>
#include <stdlib.h>
-#include <unistd.h>
#include <string.h>
-#include <errno.h>
+#include <unistd.h>
#include "s_destroy.h"
#include "s_line.h"
#include "s_struct.h"
+void f_alloc(t_msh *msh)
+{
+ char tmp[255];
+
+ ft_strlcpy(tmp, msh->argv[0], 255);
+ ft_dprintf(STDERR_FILENO, "%s: %s\n", tmp, strerror(errno));
+}
+
void f_alloc_and_destroy_msh(t_msh *msh)
{
char tmp[255];