aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/error_logger.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2013-04-29 15:28:32 +0200
committerHans Bolinder <[email protected]>2013-05-06 12:14:14 +0200
commitfa6ce2d4653bd7955c8c478a143119dbdd6b9d06 (patch)
tree0bafb8b34d91d7780bf588b614c6e04f784ed88d /lib/kernel/src/error_logger.erl
parent19d41eefa1cf4856587930d99959bbed73a818b5 (diff)
downloadotp-fa6ce2d4653bd7955c8c478a143119dbdd6b9d06.tar.gz
otp-fa6ce2d4653bd7955c8c478a143119dbdd6b9d06.tar.bz2
otp-fa6ce2d4653bd7955c8c478a143119dbdd6b9d06.zip
Fix unmatched_returns warning in Kernel
If the file given by the Kernel application variable 'error_logger' cannot be opened a crash will occur.
Diffstat (limited to 'lib/kernel/src/error_logger.erl')
-rw-r--r--lib/kernel/src/error_logger.erl20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/kernel/src/error_logger.erl b/lib/kernel/src/error_logger.erl
index 92c1eb80dc..b8fbf02feb 100644
--- a/lib/kernel/src/error_logger.erl
+++ b/lib/kernel/src/error_logger.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -245,16 +245,18 @@ notify(Msg) ->
-spec swap_handler(Type :: swap_handler_type()) -> any().
swap_handler(tty) ->
- gen_event:swap_handler(error_logger, {error_logger, swap},
- {error_logger_tty_h, []}),
- simple_logger();
+ R = gen_event:swap_handler(error_logger, {error_logger, swap},
+ {error_logger_tty_h, []}),
+ ok = simple_logger(),
+ R;
swap_handler({logfile, File}) ->
- gen_event:swap_handler(error_logger, {error_logger, swap},
- {error_logger_file_h, File}),
- simple_logger();
+ R = gen_event:swap_handler(error_logger, {error_logger, swap},
+ {error_logger_file_h, File}),
+ ok = simple_logger(),
+ R;
swap_handler(silent) ->
- gen_event:delete_handler(error_logger, error_logger, delete),
- simple_logger();
+ _ = gen_event:delete_handler(error_logger, error_logger, delete),
+ ok = simple_logger();
swap_handler(false) ->
ok. % keep primitive event handler as-is