3 ms·
I'm not sure which is wrong, the person writing or the documentation, but rename() claims to be atomic with few exceptions even when overwriting an existing ite
by rincebrain 10y ago
I'm not sure which is wrong, the person writing or the documentation, but rename() claims to be atomic with few exceptions even when overwriting an existing item.[1]
The only reason I suspect things do unlink-then-rename is that (evidently) rename() doesn't promise anything about what happens to the "src" item if rename() fails, just that something will still be in "dest".[1]
But I don't know why the commands do something different, and don't want to try reading the source of either GNU or BSD mv to find out why.
[1] - http://pubs.opengroup.org/onlinepubs/009695399/functions/rename.html http://pubs.opengroup.org/onlinepubs/009695399/functions/ren...