Re:Windows is the strangest, or hardest, operating system to...
by noasaservice on Wednesday November 30, 2022 @10:55AM
(#33802521)
> POSIX does not work this way.
Yes, it does. Windows is POSIX/FIPS-151
Re:Windows is the strangest, or hardest, operating system to...
by chasil on Wednesday November 30, 2022 @11:11AM
(#33802810)
It was, but the POSIX subsystem was removed.
In any case, I have never seen any way to coerce POSIX unlink() behavior on Windows.
'Broad software compatibility was initially achieved with support for several API "personalities", including Windows API, POSIX, and OS/2 APIs – the latter two were phased out starting with Windows XP.'
When the last directory entry for a file is passed to the unlink() system call, the file is removed from the directory hierarchy.
However, the data on media will be deleted only after all open file descriptors are closed.
One exploitation of this feature that I have seen is the SQLite temporary tablespace, which is created and immediately unlinked, ensuring that it will not persist after the program terminates.