summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/b_cd.c2
-rw-r--r--src/s_init.c5
2 files changed, 2 insertions, 5 deletions
diff --git a/src/b_cd.c b/src/b_cd.c
index 441fc3c..c4b5c1b 100644
--- a/src/b_cd.c
+++ b/src/b_cd.c
@@ -66,8 +66,6 @@ uint8_t
ft_memdel((void*)&path);
return (1);
}
- ft_memdel((void*)&msh->cwd);
- msh->cwd = getcwd(NULL, 0);
ft_memdel((void*)&path);
return (0);
}
diff --git a/src/s_init.c b/src/s_init.c
index 377cd91..a0ea9a3 100644
--- a/src/s_init.c
+++ b/src/s_init.c
@@ -86,12 +86,11 @@ t_msh
if (!(msh->shname = ft_strdup(argv[0])))
return (NULL);
/* TODO: shname: care about "./", try with symlinks */
- msh->cwd = NULL;
- msh->cwd = getcwd(NULL, 0);
- /* TODO: handle getcwd failed */
msh->envp = NULL;
if (!(msh->envp = dupenv(envp)))
return (NULL);
+ msh->cwd = NULL;
+ msh->cwd = u_get_var_value("$PWD", msh);
msh->ret = 0;
init_buptr(msh);
msh->curr = NULL;