diff options
author | dequis <dx@dxzone.com.ar> | 2018-04-08 15:52:09 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2018-04-08 15:52:09 -0300 |
commit | 8deb6182c692904733544568479035b31fe1007e (patch) | |
tree | 546be3a7de49648e465610f2490a66a2c92723f3 /scripts/autoop.pl | |
parent | b2b1ac670879ed49ebf87acc4e33212a21e8df66 (diff) | |
download | irssi-8deb6182c692904733544568479035b31fe1007e.zip |
Make config_write more atomic to prevent truncation when out of space
This is modeled after glib's g_file_set_contents. It doesn't use that
function directly because the writing is done with GIOChannel
streaming-like writes and g_file_set_contents expects the whole thing to
be in-memory.
Main differences with g_file_set_contents:
- complete lack of win32 special casing (cygwin/WSL should work though)
- no fallocate() (linux only, but we don't know the size upfront, anyway)
- always calls fsync (glib skips it on btrfs or when not overwriting)
Other than that, it's the same old mkstemp + fsync + rename.
Diffstat (limited to 'scripts/autoop.pl')
0 files changed, 0 insertions, 0 deletions