Skip to content

Commit

Permalink
fileio: sync directory after rename, too
Browse files Browse the repository at this point in the history
(cherry picked from commit 5b3f4a2)
  • Loading branch information
poettering authored and keszybz committed Sep 20, 2020
1 parent 25f1b10 commit 83b9747
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/basic/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ static int write_string_file_atomic(
goto fail;
}

if (FLAGS_SET(flags, WRITE_STRING_FILE_SYNC)) {
/* Sync the rename, too */
r = fsync_directory_of_file(fileno(f));
if (r < 0)
return r;
}

return 0;

fail:
Expand Down

0 comments on commit 83b9747

Please sign in to comment.