News for hackers. Stuff that matters.
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.
Re:C++ still isn't cutting it by Measter on Sunday October 18, 2020 @03:35PM (#24820441)
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...

Re:C++ still isn't cutting it by optimiz3 on Sunday October 18, 2020 @05:28PM (#24821257)
That's a design difference from C++ then, however even if the file is deleted the delete on Windows doesn't persist for existing open handles until the file is closed.