1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-22 16:20:23 +02:00

31637: be more selective about retry of lchdir() in cd_do_chdir()

Change of directory should not be retried relative to the current directory
when it has already failed along some path that does not refer to the
current directory.
This commit is contained in:
Barton E. Schaefer 2013-08-18 20:24:45 -07:00
parent 40a881569f
commit 935758ab7f
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2013-08-17 Barton E. Schaefer <schaefer@zsh.org>
* 31637: Src/builtin.c: change of directory should not be retried
relative to the current directory when it has already failed along
some path that does not refer to the current directory.
2013-08-11 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 31650: Src/utils.c: use zlong for mailcheck parameters to

View file

@ -1125,7 +1125,8 @@ cd_try_chdir(char *pfix, char *dest, int hard)
* argument to cd relatively. This is useful if the cwd
* or a parent directory is renamed in the interim.
*/
if (lchdir(buf, NULL, hard) && lchdir(dest, NULL, hard)) {
if (lchdir(buf, NULL, hard) &&
(pfix || *dest == '/' || lchdir(dest, NULL, hard))) {
free(buf);
return NULL;
}