diff options
author | Ron Yorston <rmy@pobox.com> | 2022-05-07 12:59:29 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2022-05-07 13:30:09 +0100 |
commit | dc6dbbd9601aeaa9f715b2ea8ec128e6b7846eb9 (patch) | |
tree | fd5aeeb96a8ca0a3263b00d9dd2c074cbdef2135 | |
parent | c5c95b22834809a5ad2fef6ec86c9f6900cc2714 (diff) | |
download | busybox-w32-dc6dbbd9601aeaa9f715b2ea8ec128e6b7846eb9.tar.gz busybox-w32-dc6dbbd9601aeaa9f715b2ea8ec128e6b7846eb9.tar.bz2 busybox-w32-dc6dbbd9601aeaa9f715b2ea8ec128e6b7846eb9.zip |
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)
-rw-r--r-- | win32/mingw.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) | |||
1453 | const char *realdir = dirname; | 1453 | const char *realdir = dirname; |
1454 | 1454 | ||
1455 | if (is_symlink(dirname)) { | 1455 | if (is_symlink(dirname)) { |
1456 | realdir = auto_string(xmalloc_readlink(dirname)); | 1456 | realdir = auto_string(xmalloc_realpath(dirname)); |
1457 | if (realdir) | 1457 | if (realdir) |
1458 | fix_path_case((char *)realdir); | 1458 | fix_path_case((char *)realdir); |
1459 | } | 1459 | } |