return fflush_and_check(f);
}
-static int write_string_file_atomic(const char *fn, const char *line, bool enforce_newline, bool do_fsync) {
+static int write_string_file_atomic(
+ const char *fn,
+ const char *line,
+ bool enforce_newline,
+ bool do_fsync,
+ struct timespec *ts) {
+
_cleanup_fclose_ FILE *f = NULL;
_cleanup_free_ char *p = NULL;
int r;
(void) fchmod_umask(fileno(f), 0644);
- r = write_string_stream(f, line, enforce_newline);
+ r = write_string_stream_ts(f, line, enforce_newline, ts);
if (r >= 0 && do_fsync)
r = fflush_sync_and_check(f);
-
if (r >= 0) {
if (rename(p, fn) < 0)
r = -errno;
if (flags & WRITE_STRING_FILE_ATOMIC) {
assert(flags & WRITE_STRING_FILE_CREATE);
- r = write_string_file_atomic(fn, line, !(flags & WRITE_STRING_FILE_AVOID_NEWLINE),
- flags & WRITE_STRING_FILE_SYNC);
+ r = write_string_file_atomic(fn,
+ line,
+ !(flags & WRITE_STRING_FILE_AVOID_NEWLINE),
+ flags & WRITE_STRING_FILE_SYNC, ts);
if (r < 0)
goto fail;