about summary refs log tree commit diff
path: root/Src/compat.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-08-21 10:04:13 +0100
committerPeter Stephenson <pws@zsh.org>2015-08-21 10:04:13 +0100
commit61afb8dc8d75106940ac4248632cb14823a3650e (patch)
treee557d9c3a3bcc506f12fe7a4b7ca5fd48680e1c8 /Src/compat.c
parent364e1717f06ff4ac8ec3b9d605ae7c272fa73ff4 (diff)
downloadzsh-61afb8dc8d75106940ac4248632cb14823a3650e.tar.gz
zsh-61afb8dc8d75106940ac4248632cb14823a3650e.tar.xz
zsh-61afb8dc8d75106940ac4248632cb14823a3650e.zip
36262: Replace fix for missing unmeta in chdir().
It was needed in the argument to one of a pair of lchdir()s rather
than within zchdir().

Add tests for the case of a character with 0x83 within it.
Diffstat (limited to 'Src/compat.c')
-rw-r--r--Src/compat.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Src/compat.c b/Src/compat.c
index a0ce1823c..db468529a 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -454,8 +454,13 @@ zgetcwd(void)
     return ret;
 }
 
-/* chdir with arbitrary long pathname.  Returns 0 on success, -1 on normal *
- * failure and -2 when chdir failed and the current directory is lost.  */
+/*
+ * chdir with arbitrary long pathname.  Returns 0 on success, -1 on normal *
+ * failure and -2 when chdir failed and the current directory is lost.
+ *
+ * This is to be treated as if at system level, so dir is unmetafied but
+ * terminated by a NULL.
+ */
 
 /**/
 mod_export int
@@ -465,7 +470,7 @@ zchdir(char *dir)
     int currdir = -2;
 
     for (;;) {
-	if (!*dir || chdir(unmeta(dir)) == 0) {
+	if (!*dir || chdir(dir) == 0) {
 #ifdef HAVE_FCHDIR
            if (currdir >= 0)
                close(currdir);