Skip to content

Commit

Permalink
Revert "[Support] PR42623: Avoid setting the delete-on-close bit if a…
Browse files Browse the repository at this point in the history
… TempFile doesn't reside on a local drive"

This reverts commit 6ec777c, which was
cherry picked to 11.x from 79657e2.

The change regressed on Windows 7 -- rust-lang/rust#81051
  • Loading branch information
cuviper authored and nikic committed Feb 27, 2021
1 parent 2a054c1 commit 96ae895
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions llvm/lib/Support/Windows/Path.inc
Original file line number Diff line number Diff line change
Expand Up @@ -402,20 +402,6 @@ std::error_code is_local(int FD, bool &Result) {
}

static std::error_code setDeleteDisposition(HANDLE Handle, bool Delete) {
// First, check if the file is on a network (non-local) drive. If so, don't
// set DeleteFile to true, since it prevents opening the file for writes.
SmallVector<wchar_t, 128> FinalPath;
if (std::error_code EC = realPathFromHandle(Handle, FinalPath))
return EC;

bool IsLocal;
if (std::error_code EC = is_local_internal(FinalPath, IsLocal))
return EC;

if (!IsLocal)
return std::error_code();

// The file is on a local drive, set the DeleteFile to true.
FILE_DISPOSITION_INFO Disposition;
Disposition.DeleteFile = Delete;
if (!SetFileInformationByHandle(Handle, FileDispositionInfo, &Disposition,
Expand Down

0 comments on commit 96ae895

Please sign in to comment.