|
|
|
|
|
by PhilipRoman
33 days ago
|
|
I'd agree if POSIX provided something like an open() flag which made the changes visible atomically, but as it stands, the rename() idiom is the mainstream way of durable file writing, so it is commonly used. Practical example using busybox sed: (GNU sed detects this case and refuses to overwrite) / # stat /dev/null
File: /dev/null
Size: 0 Blocks: 0 IO Block: 4096 character special file
...
/ # sed -i 's/foo/bar/' /dev/null
/ # stat /dev/null
File: /dev/null
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
...
|
|