summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_misc.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 9dba775e3e..cf6a483a98 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -341,14 +341,17 @@ dirty_dump_log1(LH, {K, Terms, BadBytes}) ->
append_file(File, Suffix) ->
case catch file:read_file_info(File) of
{ok, FInfo} -> append_file(File, FInfo#file_info.size, Suffix);
- {error, enoent} -> ok;
+ {error, enoent} -> append_file(File, 0, Suffix);
Error -> Error
end.
-append_file(_, 0, _) ->
- ok;
append_file(_, _, "") ->
ok;
+append_file(File, 0, Suffix) ->
+ case file:open([File, Suffix], [append]) of
+ {ok, Fd} -> file:close(Fd);
+ Error -> Error
+ end;
append_file(File, _, Suffix) ->
case file:read_file(File) of
{ok, Data} -> file:write_file([File, Suffix], Data, [append]);