diff options
author | Ron Yorston <rmy@pobox.com> | 2021-10-13 16:22:21 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-10-13 16:44:45 +0100 |
commit | 4daf57b4fdc80422d6448c0a7914699fdedb95b8 (patch) | |
tree | 72930a54811bcebacd06bac0d67bcec6b1da677a /include | |
parent | 0ecf1aea459571b48dc68ddc2b7b9265740fa960 (diff) | |
download | busybox-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 'include')
-rw-r--r-- | include/mingw.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/mingw.h b/include/mingw.h index 6ace91470..06fb3b289 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -518,6 +518,8 @@ int utimes(const char *file_name, const struct timeval times[2]); | |||
518 | * MinGW specific | 518 | * MinGW specific |
519 | */ | 519 | */ |
520 | #define is_dir_sep(c) ((c) == '/' || (c) == '\\') | 520 | #define is_dir_sep(c) ((c) == '/' || (c) == '\\') |
521 | #define is_unc_path(x) (strlen(x) > 4 && is_dir_sep(x[0]) && \ | ||
522 | is_dir_sep(x[1]) && !is_dir_sep(x[2])) | ||
521 | 523 | ||
522 | pid_t FAST_FUNC mingw_spawn(char **argv); | 524 | pid_t FAST_FUNC mingw_spawn(char **argv); |
523 | pid_t FAST_FUNC mingw_spawn_detach(char **argv); | 525 | pid_t FAST_FUNC mingw_spawn_detach(char **argv); |
@@ -580,3 +582,4 @@ int skip_ansi_emulation(int reset); | |||
580 | int unix_path(const char *path); | 582 | int unix_path(const char *path); |
581 | int has_path(const char *file); | 583 | int has_path(const char *file); |
582 | int is_relative_path(const char *path); | 584 | int is_relative_path(const char *path); |
585 | char *get_last_slash(const char *path); | ||