mirror of
git://git.code.sf.net/p/zsh/code
synced 2026-01-08 10:21:12 +01:00
34551: Avoid adding an extra "/" to the target path in cd_try_chdir() when the current directory is "/"
This commit is contained in:
parent
2c13d9fb0d
commit
2335d62548
2 changed files with 9 additions and 2 deletions
|
|
@ -1,3 +1,8 @@
|
|||
2015-02-15 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 34551: Src/builtin.c: Avoid adding an extra "/" to the
|
||||
target path in cd_try_chdir() when the current directory is "/"
|
||||
|
||||
2015-02-14 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 34543: Src/input.c, Src/lex.c: Fix crash on garbage bytes
|
||||
|
|
|
|||
|
|
@ -1093,9 +1093,11 @@ cd_try_chdir(char *pfix, char *dest, int hard)
|
|||
} else {
|
||||
int pfl = strlen(pfix);
|
||||
dlen = strlen(pwd);
|
||||
|
||||
if (dlen == 1 && *pwd == '/')
|
||||
dlen = 0;
|
||||
buf = zalloc(dlen + pfl + strlen(dest) + 3);
|
||||
strcpy(buf, pwd);
|
||||
if (dlen)
|
||||
strcpy(buf, pwd);
|
||||
buf[dlen] = '/';
|
||||
strcpy(buf + dlen + 1, pfix);
|
||||
buf[dlen + 1 + pfl] = '/';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue