diff options
author | Ron Yorston <rmy@pobox.com> | 2020-12-12 13:23:38 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2020-12-12 13:23:38 +0000 |
commit | f902184fa8aa37b0ce8b725da5657ef2ed2005dd (patch) | |
tree | c31830d6f08e585c73f7c5a15faf1e035109cef7 | |
parent | 26b641cde2e1bb2ed95683afa94b31ba0207339d (diff) | |
download | busybox-w32-f902184fa8aa37b0ce8b725da5657ef2ed2005dd.tar.gz busybox-w32-f902184fa8aa37b0ce8b725da5657ef2ed2005dd.tar.bz2 busybox-w32-f902184fa8aa37b0ce8b725da5657ef2ed2005dd.zip |
win32: make realpath() return an error if necessary
resolve_symlinks() uses GetFinalPathNameByHandleA which is loaded
at runtime because it isn't available in all versions of Windows.
If GetFinalPathNameByHandleA isn't available resolve_symlinks()
(and hence realpath()) should return a NULL pointer to indicate an
error, not the original path. Not returning NULL causes an infinite
loop in do_lstat().
See GitHub issue #204.
-rw-r--r-- | win32/mingw.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 75f15aa30..ed0989be2 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -1088,7 +1088,6 @@ static char *resolve_symlinks(char *path) | |||
1088 | FILE_FLAG_BACKUP_SEMANTICS, NULL); | 1088 | FILE_FLAG_BACKUP_SEMANTICS, NULL); |
1089 | if (h != INVALID_HANDLE_VALUE) { | 1089 | if (h != INVALID_HANDLE_VALUE) { |
1090 | if (!INIT_PROC_ADDR(kernel32.dll, GetFinalPathNameByHandleA)) { | 1090 | if (!INIT_PROC_ADDR(kernel32.dll, GetFinalPathNameByHandleA)) { |
1091 | ptr = path; | ||
1092 | goto end; | 1091 | goto end; |
1093 | } | 1092 | } |
1094 | 1093 | ||