Skip to content

Commit

Permalink
Merge branch 'klacke-yaws-log-fd-leak'
Browse files Browse the repository at this point in the history
Fd leak
  • Loading branch information
Claes Wikstrom committed Sep 22, 2014
2 parents a48c310 + 08156ba commit d7e4460
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/yaws_logger.erl
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,23 @@ authlog(#sconf{servername=Srv}, IP, Path, Item) ->
%%%----------------------------------------------------------------------
%%% Internal functions
%%%----------------------------------------------------------------------

do_open_log(#sconf{servername=Srv, logger_mod=Mod}, Type, Dir) ->
case catch Mod:open_log(Srv, Type, Dir) of
{true, Data} ->
AL = #log{id={Type, Srv}, amod=Mod, data=Data},
ets:insert(yaws_log, AL),
true;
Id = {Type, Srv},
case ets:lookup(yaws_log, Id) of
[] ->
case catch Mod:open_log(Srv, Type, Dir) of
{true, Data} ->
AL = #log{id={Type, Srv}, amod=Mod, data=Data},
ets:insert(yaws_log, AL),
true;
_ ->
false
end;
_ ->
false
%% Already exists. Might be the case that both http and https
%% has been enabled and we don't want to open the same log twice.
true
end.


Expand Down

0 comments on commit d7e4460

Please sign in to comment.