Closed Mic92 closed 2 months ago
I updated the commit description:
atomic_rename: fix potential race condition
When two threads override the same file at the same time,
they might end up both opening the same tmp file i.e. `/etc/passwd.tmp`
and than writing their content to the same.
The new approach opens the tmp file with `create_new` flag, which
fails if the file already exists. In that case, it increments the
index and tries again.
Can you provide a description of what that fixes and how? I fear I don't really get it from the code.
And more concretely: why do I want to always create a new .tmp file instead of just overwriting an existing one?