summaryrefslogtreecommitdiffstats
path: root/src/m_mshrc.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/m_mshrc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/m_mshrc.c b/src/m_mshrc.c
index f730113..7f6b8b9 100644
--- a/src/m_mshrc.c
+++ b/src/m_mshrc.c
@@ -15,6 +15,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
+#include <limits.h>
#include "d_define.h"
#include "s_struct.h"
@@ -24,15 +25,13 @@
uint8_t
m_source_mshrc(t_msh *msh)
{
+ char file[PATH_MAX];
+ char home[PATH_MAX];
int32_t fd;
- char *home;
- char file[2048];
uint8_t ret;
- if ((home = u_get_var_value("$HOME", msh)) == NULL)
- return (0);
+ u_get_var_value(home, "$HOME", PATH_MAX, msh);
ft_sprintf(file, "%s/%s", home, FT_MINISHELLRC);
- ft_memdel((void*)&home);
if ((fd = open(file, O_RDONLY)) < 0)
return (0);
ret = m_loop(fd, msh);