Re:C++ still isn't cutting it
by optimiz3 on Sunday October 18, 2020 @12:34PM
(#24819037)
In equivalent C++ on Windows, f is a file handle without delete share permissions so the act of successful opening the file locks out delete operations until the file handle is closed, preventing TTCTTOU issues. Am assuming Rust would be backed by the same is mechanism.
[ Parent
| on HN ]
On Windows Rust calls out to `CreateFileW`[0], and by default uses the `FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE` share permission[1].
[0] https://github.com/rust-lang/rust/blob/master/library/std/sr...
[1] https://doc.rust-lang.org/std/os/windows/fs/trait.OpenOption...