summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2013-07-25 12:21:22 +0100
committerEmile Joubert <emile@rabbitmq.com>2013-07-25 12:21:22 +0100
commit6928e7a1063c657b4ffacd0631a32f66d5a2960a (patch)
tree6a6a9f13c070ee9960bedeed732120a439663564
parent1bbc5600b2e0059d409cbd745443ebede701732f (diff)
downloadrabbitmq-server-6928e7a1063c657b4ffacd0631a32f66d5a2960a.tar.gz
Re-order
-rw-r--r--src/rabbit_file.erl28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/rabbit_file.erl b/src/rabbit_file.erl
index 7f0add2b..93b9c901 100644
--- a/src/rabbit_file.erl
+++ b/src/rabbit_file.erl
@@ -145,6 +145,19 @@ write_file(Path, Data, Modes) ->
{error, _} = E -> E
end.
+%% make_binary/1 is based on the corresponding function in the
+%% kernel/file.erl module of the Erlang R14B02 release, which is
+%% licensed under the EPL.
+
+make_binary(Bin) when is_binary(Bin) ->
+ Bin;
+make_binary(List) ->
+ try
+ iolist_to_binary(List)
+ catch error:Reason ->
+ {error, Reason}
+ end.
+
write_file1(Path, Bin, Modes) ->
try
with_synced_copy(Path, Modes,
@@ -157,13 +170,13 @@ write_file1(Path, Bin, Modes) ->
end.
with_synced_copy(Path, Modes, Fun) ->
- Bak = Path ++ ?TMP_EXT,
case lists:member(append, Modes) of
true ->
{error, append_not_supported, Path};
false ->
with_fhc_handle(
fun () ->
+ Bak = Path ++ ?TMP_EXT,
case prim_file:open(Bak, Modes) of
{ok, Hdl} ->
try
@@ -179,19 +192,6 @@ with_synced_copy(Path, Modes, Fun) ->
end)
end.
-%% make_binary/1 is based on the corresponding function in the
-%% kernel/file.erl module of the Erlang R14B02 release, which is
-%% licensed under the EPL.
-
-make_binary(Bin) when is_binary(Bin) ->
- Bin;
-make_binary(List) ->
- try
- iolist_to_binary(List)
- catch error:Reason ->
- {error, Reason}
- end.
-
%% TODO the semantics of this function are rather odd. But see bug 25021.
append_file(File, Suffix) ->
case read_file_info(File) of