summaryrefslogtreecommitdiffstats
path: root/src/s_init_next.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/s_init_next.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 'src/s_init_next.c')
-rw-r--r--src/s_init_next.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/s_init_next.c b/src/s_init_next.c
index d506d9d..3cc676d 100644
--- a/src/s_init_next.c
+++ b/src/s_init_next.c
@@ -24,11 +24,12 @@
#include "b_export_next.h"
#include "f_fail.h"
+#include "s_destroy.h"
#include "s_struct.h"
#include "u_vars.h"
#include "u_vars_next.h"
-void s_inc_shlvl(t_msh *msh)
+char s_inc_shlvl(t_msh *msh)
{
char fmt[8];
char tmp[255];
@@ -49,8 +50,12 @@ void s_inc_shlvl(t_msh *msh)
shlvl = (shlvl >= 999) ? 0 : shlvl;
shlvl = (shlvl < 0) ? 0 : shlvl + 1;
ft_itoa_s(str, shlvl);
- u_subst_var_value("$SHLVL", str, msh);
+ if (u_subst_var_value("$SHLVL", str, msh) == 1)
+ {
+ return (1);
+ }
}
+ return (0);
}
char **s_dupenv_del(char **nenvp, unsigned long i)