mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-18 05:05:36 +00:00
Fix IsHardLink() to return false instead of throwing exception when unable to determine (#7355)
This commit is contained in:
1 parent
20f7577548
commit
b767d5cacd
2 files changed
+11
-19
No files matched your search
@@ -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