diff options
author | Ron Yorston <rmy@pobox.com> | 2021-03-01 09:37:50 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-03-01 09:37:50 +0000 |
commit | b5cd41cdf4e6afd475fe34b755f99578e20b08ca (patch) | |
tree | 669463610c986ce3c1257ab02c2e51621b0bbef9 | |
parent | 4986a1248dcdb6f32a22321154dc26898f10d3ab (diff) | |
download | busybox-w32-symlink.tar.gz busybox-w32-symlink.tar.bz2 busybox-w32-symlink.zip |
libbb: fix detection of relative paths in xreadlink.csymlink
In xmalloc_follow_symlinks() the code to detect relative paths
needs to be altered for WIN32. We don't want C:/path to be
treated as a relative path.
-rw-r--r-- | libbb/xreadlink.c | 4 | ||||
-rw-r--r-- | win32/mingw.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c index ca53e12d3..f0a63fd9b 100644 --- a/libbb/xreadlink.c +++ b/libbb/xreadlink.c | |||
@@ -76,7 +76,11 @@ char* FAST_FUNC xmalloc_follow_symlinks(const char *path) | |||
76 | return NULL; | 76 | return NULL; |
77 | } | 77 | } |
78 | 78 | ||
79 | #if ENABLE_PLATFORM_MINGW32 | ||
80 | if (!is_absolute_path(linkpath)) { | ||
81 | #else | ||
79 | if (*linkpath != '/') { | 82 | if (*linkpath != '/') { |
83 | #endif | ||
80 | bufsize += strlen(linkpath); | 84 | bufsize += strlen(linkpath); |
81 | buf = xrealloc(buf, bufsize); | 85 | buf = xrealloc(buf, bufsize); |
82 | lpc = bb_get_last_path_component_strip(buf); | 86 | lpc = bb_get_last_path_component_strip(buf); |
diff --git a/win32/mingw.c b/win32/mingw.c index a222e6226..1a00787b7 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -843,7 +843,7 @@ int mingw_rename(const char *pold, const char *pnew) | |||
843 | return -1; | 843 | return -1; |
844 | } | 844 | } |
845 | if (MoveFileEx(pold, pnew, | 845 | if (MoveFileEx(pold, pnew, |
846 | MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED)) | 846 | MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED)) |
847 | return 0; | 847 | return 0; |
848 | /* TODO: translate more errors */ | 848 | /* TODO: translate more errors */ |
849 | if (GetLastError() == ERROR_ACCESS_DENIED && | 849 | if (GetLastError() == ERROR_ACCESS_DENIED && |