diff options
author | Ron Yorston <rmy@pobox.com> | 2020-06-30 15:44:20 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2020-06-30 15:52:54 +0100 |
commit | 90b695c255eeeddb2bb90e5cacbd3253663bfa7f (patch) | |
tree | 623627f54f8f131db7eb1029c556a60c0a0649dc /win32 | |
parent | 9114e110a59a77909132af6d97bccdf5056adfa4 (diff) | |
download | busybox-w32-90b695c255eeeddb2bb90e5cacbd3253663bfa7f.tar.gz busybox-w32-90b695c255eeeddb2bb90e5cacbd3253663bfa7f.tar.bz2 busybox-w32-90b695c255eeeddb2bb90e5cacbd3253663bfa7f.zip |
ash: improve handling of UNC paths
Be more strict about identifying UNC paths in unc_root_len().
In updatepwd() in ash:
- Skip duplicate leading slashes unless the directory is a UNC path.
- Rewrite detection and handling of the five possible types of path.
This improves cases like 'cd ///' and 'cd /xyz' when the current
directory is a UNC path.
See GitHub issue #192.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 06b22a2ed..78d662e50 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -1643,7 +1643,8 @@ void hide_console(void) | |||
1643 | #endif | 1643 | #endif |
1644 | 1644 | ||
1645 | #define is_path_sep(x) ((x) == '/' || (x) == '\\') | 1645 | #define is_path_sep(x) ((x) == '/' || (x) == '\\') |
1646 | #define is_unc_path(x) (is_path_sep(x[0]) && is_path_sep(x[1])) | 1646 | #define is_unc_path(x) (strlen(x) > 4 && is_path_sep(x[0]) && \ |
1647 | is_path_sep(x[1]) && !is_path_sep(x[2])) | ||
1647 | 1648 | ||
1648 | /* Return the length of the root of a UNC path, i.e. the '//host/share' | 1649 | /* Return the length of the root of a UNC path, i.e. the '//host/share' |
1649 | * component, or 0 if the path doesn't look like that. */ | 1650 | * component, or 0 if the path doesn't look like that. */ |