Skip to content

Commit

Permalink
Restore a change to improve backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kouvel committed Aug 10, 2023
1 parent 6c99e52 commit 00dc153
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/coreclr/pal/src/sharedmemory/sharedmemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ bool SharedMemoryHelpers::EnsureDirectoryExists(
}
if (!createIfNotExist || chmod(path, PermissionsMask_AllUsers_ReadWriteExecute) != 0)
{
throw SharedMemoryException(static_cast<DWORD>(SharedMemoryError::IO));
// We were not asked to create the path or we weren't able to set the new permissions.
// As a last resort, check that at least the current user has full access.
if ((statInfo.st_mode & PermissionsMask_CurrentUser_ReadWriteExecute) != PermissionsMask_CurrentUser_ReadWriteExecute)
{
throw SharedMemoryException(static_cast<DWORD>(SharedMemoryError::IO));
}
}
return true;
}
Expand Down

0 comments on commit 00dc153

Please sign in to comment.