aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorMagnus Henoch <[email protected]>2011-09-15 09:51:33 +0100
committerMagnus Henoch <[email protected]>2011-09-15 09:59:40 +0100
commit9319587de60b67f3de689de60b473136fd45cadd (patch)
tree53b729edf963fa2d23011eeae3727b83db9931f8 /lib/kernel
parent68c96ca855821adb42a25ced5b69446ae7ccc635 (diff)
downloadotp-9319587de60b67f3de689de60b473136fd45cadd.tar.gz
otp-9319587de60b67f3de689de60b473136fd45cadd.tar.bz2
otp-9319587de60b67f3de689de60b473136fd45cadd.zip
Specify file name and error on create_cookie failure
The error message for failing to create a cookie file is much more helpful when it specifies the actual file it tried to use and the error that occurred.
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/src/auth.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/kernel/src/auth.erl b/lib/kernel/src/auth.erl
index ac25ab958c..7bdaa63d07 100644
--- a/lib/kernel/src/auth.erl
+++ b/lib/kernel/src/auth.erl
@@ -381,13 +381,17 @@ create_cookie(Name) ->
case {R1, R2} of
{ok, ok} ->
ok;
- {{error,_Reason}, _} ->
- {error, "Failed to create cookie file"};
+ {{error,Reason}, _} ->
+ {error,
+ lists:flatten(
+ io_lib:format("Failed to write to cookie file '~s': ~p", [Name, Reason]))};
{ok, {error, Reason}} ->
{error, "Failed to change mode: " ++ atom_to_list(Reason)}
end;
- {error,_Reason} ->
- {error, "Failed to create cookie file"}
+ {error,Reason} ->
+ {error,
+ lists:flatten(
+ io_lib:format("Failed to create cookie file '~s': ~p", [Name, Reason]))}
end.
random_cookie(0, _, Result) ->