Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Make config_write more atomic to prevent truncation when out of space #871
This is modeled after glib's g_file_set_contents. It doesn't use that
Main differences with g_file_set_contents:
Other than that, it's the same old mkstemp + fsync + rename.
In #817 (comment) I mentioned I wasn't sure if i should keep copying g_file_set_contents(). Few months later, no one is going to refactor config writing to be in-memory, so finishing that WIP code is obviously better than nothing.
The WIP code used g_rename, g_unlink, but those require including gstdio.h and their implementation is all win32 portability code so mehhhh.