-
Philip Withnall authored
This moves `write_to_temp_file()` into `g_file_set_contents_full()` and coalesces its handling of `do_fsync` with the `rename_file()` call. It adds support for `G_FILE_SET_CONTENTS_DURABLE` and `G_FILE_SET_CONTENTS_NONE` — previously only `G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING` was supported. In the case that `G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_DURABLE` is set, an additional `fsync()` is now done on the directory after renaming the temporary file. In the case that `G_FILE_SET_CONTENTS_ONLY_EXISTING` isn’t set, the `fsync()` after writing the temporary file will always be done (unless the file system guarantees it never needs to be done). In the case that only `G_FILE_SET_CONTENTS_DURABLE` is set, the destination file will be written to directly (using this mode is not really advised). Signed-off-by: Philip Withnall <withnall@endlessm.com> Fixes: #1302
f3cea1c4