From dc6dbbd9601aeaa9f715b2ea8ec128e6b7846eb9 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sat, 7 May 2022 12:59:29 +0100 Subject: win32: fix 'cd' to symlink with relative path as target Commit 69d328022 (win32: track current directory of mapped drives) replaced a call to xmalloc_realpath() with one to xmalloc_readlink(). This was incorrect. Although the argument is now guaranteed to be a symlink it's still necessary to resolve it to an absolute path. Otherwise the fix in commit 585d17d26 (win32: canonicalize path in chdir(2)) doesn't work for symlinks with a relative path as their target. (GitHub issue #147) --- win32/mingw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/mingw.c b/win32/mingw.c index d6b725e17..5601d8428 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -1453,7 +1453,7 @@ int mingw_chdir(const char *dirname) const char *realdir = dirname; if (is_symlink(dirname)) { - realdir = auto_string(xmalloc_readlink(dirname)); + realdir = auto_string(xmalloc_realpath(dirname)); if (realdir) fix_path_case((char *)realdir); } -- cgit v1.2.3-55-g6feb