mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix IsHardLink() to return false instead of throwing exception when unable to determine (#7355)
This commit is contained in:
@@ -8111,19 +8111,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
{
|
||||
BY_HANDLE_FILE_INFORMATION handleInfo;
|
||||
bool succeeded = InternalSymbolicLinkLinkCodeMethods.GetFileInformationByHandle(handle, out handleInfo);
|
||||
|
||||
if (!succeeded)
|
||||
{
|
||||
int lastError = Marshal.GetLastWin32Error();
|
||||
throw new Win32Exception(lastError);
|
||||
}
|
||||
|
||||
if (handleInfo.NumberOfLinks > 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return succeeded && (handleInfo.NumberOfLinks > 1);
|
||||
}
|
||||
|
||||
private static string InternalGetTarget(SafeFileHandle handle)
|
||||
|
||||
Reference in New Issue
Block a user