aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-10-13 16:22:21 +0100
committerRon Yorston <rmy@pobox.com>2021-10-13 16:44:45 +0100
commit4daf57b4fdc80422d6448c0a7914699fdedb95b8 (patch)
tree72930a54811bcebacd06bac0d67bcec6b1da677a /win32
parent0ecf1aea459571b48dc68ddc2b7b9265740fa960 (diff)
downloadbusybox-w32-4daf57b4fdc80422d6448c0a7914699fdedb95b8.tar.gz
busybox-w32-4daf57b4fdc80422d6448c0a7914699fdedb95b8.tar.bz2
busybox-w32-4daf57b4fdc80422d6448c0a7914699fdedb95b8.zip
realpath: improved support for Windows paths
Upstream commit 94eb1c4dc (libbb: better coreutils compatibility for realpath) made some changes to xmalloc_realpath_coreutils(). This now needs to be updated to handle Windows paths. - Expose the macro is_unc_path() and part of the recent change to bb_get_last_path_component_nostrip() as a separate funtion, get_last_slash(); - Convert a couple of errors relating to network filesystems to ENOENT; - Adjust xmalloc_realpath_coreutils() to handle Windows directory separators, relative paths and UNC paths.
Diffstat (limited to 'win32')
-rw-r--r--win32/mingw.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/win32/mingw.c b/win32/mingw.c
index fa68ea608..d4855a7e7 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -64,6 +64,8 @@ int err_win_to_posix(void)
64 case ERROR_BAD_FORMAT: error = ENOEXEC; break; 64 case ERROR_BAD_FORMAT: error = ENOEXEC; break;
65 case ERROR_BAD_LENGTH: error = EINVAL; break; 65 case ERROR_BAD_LENGTH: error = EINVAL; break;
66 case ERROR_BAD_PATHNAME: error = ENOENT; break; 66 case ERROR_BAD_PATHNAME: error = ENOENT; break;
67 case ERROR_BAD_NET_NAME: error = ENOENT; break;
68 case ERROR_BAD_NETPATH: error = ENOENT; break;
67 case ERROR_BAD_PIPE: error = EPIPE; break; 69 case ERROR_BAD_PIPE: error = EPIPE; break;
68 case ERROR_BAD_UNIT: error = ENODEV; break; 70 case ERROR_BAD_UNIT: error = ENODEV; break;
69 case ERROR_BAD_USERNAME: error = EINVAL; break; 71 case ERROR_BAD_USERNAME: error = EINVAL; break;
@@ -1877,9 +1879,6 @@ void hide_console(void)
1877} 1879}
1878#endif 1880#endif
1879 1881
1880#define is_unc_path(x) (strlen(x) > 4 && is_dir_sep(x[0]) && \
1881 is_dir_sep(x[1]) && !is_dir_sep(x[2]))
1882
1883/* Return the length of the root of a UNC path, i.e. the '//host/share' 1882/* Return the length of the root of a UNC path, i.e. the '//host/share'
1884 * component, or 0 if the path doesn't look like that. */ 1883 * component, or 0 if the path doesn't look like that. */
1885int unc_root_len(const char *dir) 1884int unc_root_len(const char *dir)