Permalink
Browse files

return error when either peerid or peercred is not available on the p…

…latform
  • Loading branch information...
1 parent 438bed4 commit 2166d135330e1d677aa54c3340e9133be8ac98d5 @tonyrog committed Feb 20, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/afunix.erl
View
@@ -274,13 +274,17 @@ get_peercred(S) ->
case ctl_cmd(S, ?INET_REQ_GETOPTS, [?UNIX_OPT_PEERCRED]) of
{ok,[?UNIX_OPT_PEERCRED,U3,U2,U1,U0]} ->
{ok, ?u32(U3,U2,U1,U0)};
+ {ok, []} ->
+ {error, einval};
{error,_}=Error -> Error
end.
%% get peer-credentials (only effecive uid right now)
get_peerpid(S) ->
case ctl_cmd(S, ?INET_REQ_GETOPTS, [?UNIX_OPT_PEERPID]) of
{ok,[?UNIX_OPT_PEERPID,U3,U2,U1,U0]} ->
{ok, ?u32(U3,U2,U1,U0)};
+ {ok, []} ->
+ {error, einval};
{error,_}=Error -> Error
end.

0 comments on commit 2166d13

Please sign in to comment.