diff options
| author | Edward Thomson <ethomson@github.com> | 2017-02-17 16:36:53 +0000 |
|---|---|---|
| committer | Edward Thomson <ethomson@github.com> | 2017-02-28 13:28:36 +0000 |
| commit | 1229e1c4d7ea1eb4c5bcd5c0d89bc576053175db (patch) | |
| tree | eaa95a9af16669ea7497dc30091b220a54404d5d /src/filebuf.c | |
| parent | 5a747e0c6c5170d29969eb15822c36d76dd3e4ac (diff) | |
| download | libgit2-1229e1c4d7ea1eb4c5bcd5c0d89bc576053175db.tar.gz | |
fsync parent directories when fsyncing
When fsync'ing files, fsync the parent directory in the case where we
rename a file into place, or create a new file, to ensure that the
directory entry is flushed correctly.
Diffstat (limited to 'src/filebuf.c')
| -rw-r--r-- | src/filebuf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/filebuf.c b/src/filebuf.c index c4a13ffab..f37cf02b4 100644 --- a/src/filebuf.c +++ b/src/filebuf.c @@ -445,6 +445,9 @@ int git_filebuf_commit(git_filebuf *file) goto on_error; } + if (file->do_fsync && git_futils_fsync_parent(file->path_original) < 0) + goto on_error; + file->did_rename = true; git_filebuf_cleanup(file); |
