Skip to content

Commit

Permalink
Merge branch 'pan/win_symbolic_link_fixes/OTP-9279' into dev
Browse files Browse the repository at this point in the history
* pan/win_symbolic_link_fixes/OTP-9279:
  Add error code for cyclic symbolic links and make directory links readable
  • Loading branch information
psyeugenic committed Sep 16, 2011
2 parents 9c87b49 + e7580bd commit 0c41940
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions erts/emulator/drivers/win32/win_efile.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ static int errno_map(DWORD last_error) {
return EBUSY;
case ERROR_NO_PROC_SLOTS:
return EAGAIN;
case ERROR_CANT_RESOLVE_FILENAME:
return EMLINK;
case ERROR_ARENA_TRASHED:
case ERROR_INVALID_BLOCK:
case ERROR_BAD_ENVIRONMENT:
Expand Down Expand Up @@ -1405,7 +1407,7 @@ efile_readlink(Efile_error* errInfo, char* name, char* buffer, size_t size)
DWORD fileAttributes = GetFileAttributesW(wname);
if ((fileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
BOOLEAN success = 0;
HANDLE h = CreateFileW(wname, GENERIC_READ, 0,NULL, OPEN_EXISTING, 0, NULL);
HANDLE h = CreateFileW(wname, GENERIC_READ, 0,NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
int len;
if(h != INVALID_HANDLE_VALUE) {
success = pGetFinalPathNameByHandle(h, wbuffer, size,0);
Expand All @@ -1421,7 +1423,7 @@ efile_readlink(Efile_error* errInfo, char* name, char* buffer, size_t size)
if (*wbuffer == L'\\')
*wbuffer = L'/';
CloseHandle(h);
}
}
FreeLibrary(hModule);
if (success) {
return 1;
Expand Down

0 comments on commit 0c41940

Please sign in to comment.