summaryrefslogtreecommitdiffstats
path: root/bin/sh/cd.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/cd.c')
-rw-r--r--bin/sh/cd.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/bin/sh/cd.c b/bin/sh/cd.c
index 7720fad..017dfa1 100644
--- a/bin/sh/cd.c
+++ b/bin/sh/cd.c
@@ -182,7 +182,6 @@ cdlogical(char *dest)
struct stat statb;
int first;
int badstat;
- size_t len;
/*
* Check each component of the path. If we find a symlink or
@@ -190,9 +189,7 @@ cdlogical(char *dest)
* next time we get the value of the current directory.
*/
badstat = 0;
- len = strlen(dest);
- cdcomppath = stalloc(len + 1);
- memcpy(cdcomppath, dest, len + 1);
+ cdcomppath = stsavestr(dest);
STARTSTACKSTR(p);
if (*dest == '/') {
STPUTC('/', p);
@@ -277,7 +274,6 @@ findcwd(char *dir)
{
char *new;
char *p;
- size_t len;
/*
* If our argument is NULL, we don't know the current directory
@@ -286,9 +282,7 @@ findcwd(char *dir)
*/
if (dir == NULL || curdir == NULL)
return getpwd2();
- len = strlen(dir);
- cdcomppath = stalloc(len + 1);
- memcpy(cdcomppath, dir, len + 1);
+ cdcomppath = stsavestr(dir);
STARTSTACKSTR(new);
if (*dir != '/') {
STPUTS(curdir, new);
OpenPOWER on IntegriCloud