Skip to content

Commit ec4523a

Browse files
committed
fixup! Win32: symlink: add support for symlinks to directories
Change the way how directory symlinks are detected by trying to open the link's target instead of the link itself. It seems that Windows 10 1803 (April 2018 Update) does not allow to call CreateFile on a link of a wrong type. If a file symlink points to a directory an attempt to open it with CreateFile causes an ERROR_ACCESS_DENIED. This behavior is different in previous version of Windows 10 (CreateFile opens the incorrect link without complaining), that's why it worked fine before. This fixes #1646 Signed-off-by: Michał Dudak <[email protected]>
1 parent e6ee2f7 commit ec4523a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/mingw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static enum phantom_symlink_result process_phantom_symlink(
297297
return PHANTOM_SYMLINK_DONE;
298298

299299
/* let Windows resolve the link by opening it */
300-
hnd = CreateFileW(wlink, 0,
300+
hnd = CreateFileW(wtarget, 0,
301301
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
302302
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
303303
if (hnd == INVALID_HANDLE_VALUE) {

0 commit comments

Comments
 (0)