Skip to content

Commit

Permalink
Fix some build issues from previous commit for dotnet#77835 again (4)
Browse files Browse the repository at this point in the history
• Add missing parameter value (openNewFile) to OpenCopyFileDstHandle
• Fix misnamed variable usages throughout some code
• Properly qualify Interop.ErrorInfo
• This should be the last fix for build issues for this set
  • Loading branch information
hamarb123 committed Dec 5, 2022
1 parent 1e43a91 commit 4c5a995
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static partial void CopyFile(string sourceFullPath, string destFullPath,
if (overwrite)
{
//Get a lock to the dest file for compat reasons, and then delete it.
using SafeFileHandle dstHandle = OpenCopyFileDstHandle(destFullPath, true, startedCopyFile);
using SafeFileHandle dstHandle = OpenCopyFileDstHandle(destFullPath, true, startedCopyFile, false);
File.Delete(destFullPath);
goto tryAgainWithReadLink;
}
Expand All @@ -104,9 +104,9 @@ public static partial void CopyFile(string sourceFullPath, string destFullPath,
throwError:
if (directoryExist)
{
throw new IOException(SR.Format(SR.Arg_FileIsDirectory_Name, path));
throw new IOException(SR.Format(SR.Arg_FileIsDirectory_Name, destFullPath));
}
throw Interop.GetExceptionForIoErrno(new ErrorInfo(error));
throw Interop.GetExceptionForIoErrno(new Interop.ErrorInfo(error));

//Fallback to the standard unix implementation for when cloning is not supported
fallback:
Expand All @@ -127,7 +127,7 @@ public static partial void CopyFile(string sourceFullPath, string destFullPath,
{
try
{
return ResolveLinkTargetString(sourceFullPath, true, false);
return ResolveLinkTargetString(path, true, false);
}
catch
{
Expand All @@ -138,7 +138,7 @@ public static partial void CopyFile(string sourceFullPath, string destFullPath,
//Checks if a file or directory exists without caring which it was
static bool FileOrDirectoryExists(string path)
{
return Interop.Sys.Stat(fullPath, out _) >= 0;
return Interop.Sys.Stat(path, out _) >= 0;
}
}
}
Expand Down

0 comments on commit 4c5a995

Please sign in to comment.