diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2013-10-21 13:35:14 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2013-10-21 13:35:14 +0100 |
commit | 077442f1a5fb4a111d818a6d1ea471d8a4623545 (patch) | |
tree | fa16adab69f14c336c3ed2abbeb15a282cce7a06 | |
parent | 910f2419af12cde5a895c9356c6d67a0875d8e1f (diff) | |
download | rabbitmq-server-bug25826.tar.gz |
Sync before rename, since the rename is not affected by the sync and doing it this way round means we can't expose the results of a half-written but renamed file by crashing after the rename but before the sync.bug25826
-rw-r--r-- | src/rabbit_file.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rabbit_file.erl b/src/rabbit_file.erl index 4cf314ca..1a766b05 100644 --- a/src/rabbit_file.erl +++ b/src/rabbit_file.erl @@ -181,8 +181,8 @@ with_synced_copy(Path, Modes, Fun) -> {ok, Hdl} -> try Result = Fun(Hdl), - ok = prim_file:rename(Bak, Path), ok = prim_file:sync(Hdl), + ok = prim_file:rename(Bak, Path), Result after prim_file:close(Hdl) |