[PATCH] D38570: Support: Rewrite Windows implementation of sys::fs::rename to be more POSIXy.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 11:21:31 PDT 2017


Peter Collingbourne via Phabricator via llvm-commits
<llvm-commits at lists.llvm.org> writes:


> +  while (1) {
> +    auto EC = rename_internal(FromHandle, To, true);
> +    if (!EC || EC != errc::permission_denied)
> +      return EC;
...
> +    // The destination file probably exists and is currently open in another
> +    // process. Rename it to move it out of the way of the source file. Use
> +    // FILE_FLAG_DELETE_ON_CLOSE to arrange for the destination file to be
> +    // deleted when the other process closes it.

This only happens if the file is open without FILE_SHARE_DELETE mode, no?
When do we expect to hit that? If only when a virus scanner is running,
shouldn't we just sleep and wait for it to close it?

Cheers,
Rafael


More information about the llvm-commits mailing list