disable the writeFileAtomic() function on Windows
Summary: This puts the `writeFileAtomic()` function behind and `#ifndef _WIN32` check, to disable it on Windows. While this function currently compiles on Windows, it does not behave correctly: it often fails with "Permission denied" errors when trying to use folly's emulated `fchmod()` function. Additionally, even the `fchmod()` succeeds (or is skipped) it fails if the destination path already exists, as `rename()` on Windows does not allow replacing an existing file. While we could attempt to replace the existing file, doing so would not be atomic. We might be able to achieve this with transactional NTFS features if the underlying file system is NTFS, but according to Microsoft these APIs are discouraged and may be removed in future versions of Windows. Therefore for now simply disable `writeFileAtomic()` on Windows. Differential Revision: D21367511 fbshipit-source-id: 50a5a1004feacc8bdb0a24421bea339962e1d546
Showing
Please register or sign in to comment