diff options
author | Siri Hansen <[email protected]> | 2017-09-07 17:34:58 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2017-09-07 17:34:58 +0200 |
commit | 695ce64b3168c3fcc2d5f2de5cb74701f767e71d (patch) | |
tree | 153c3af70c221a063844e922d29c11ee9b82b64e /lib/sasl/src/sasl_report_file_h.erl | |
parent | f4c24c5faba8cbf0817b4dd9559e2ae2223525f0 (diff) | |
parent | b569db7fd80de6f6f049797fa7676bdfbe55cc4f (diff) | |
download | otp-695ce64b3168c3fcc2d5f2de5cb74701f767e71d.tar.gz otp-695ce64b3168c3fcc2d5f2de5cb74701f767e71d.tar.bz2 otp-695ce64b3168c3fcc2d5f2de5cb74701f767e71d.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/sasl/src/sasl_report_file_h.erl')
-rw-r--r-- | lib/sasl/src/sasl_report_file_h.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/sasl/src/sasl_report_file_h.erl b/lib/sasl/src/sasl_report_file_h.erl index 21746839fa..d3b5c7dc0d 100644 --- a/lib/sasl/src/sasl_report_file_h.erl +++ b/lib/sasl/src/sasl_report_file_h.erl @@ -29,15 +29,27 @@ handle_event/2, handle_call/2, handle_info/2, terminate/2]). -init({File, Modes, Type}) when is_list(Modes) -> +init({File, Modes0, Type}) when is_list(Modes0) -> process_flag(trap_exit, true), + Modes1 = + case lists:keymember(encoding,1,Modes0) of + true -> Modes0; + false -> [{encoding,utf8}|Modes0] + end, + Modes = + case [M || M <- Modes1, lists:member(M,[write,append,exclusive])] of + [] -> + [write|Modes1]; + _ -> + Modes1 + end, case file:open(File, Modes) of {ok,Fd} -> {ok, {Fd, File, Type}}; What -> What end. - + handle_event({_Type, GL, _Msg}, State) when node(GL) /= node() -> {ok, State}; handle_event(Event, {Fd, File, Type}) -> |