25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Fix integer parameter which can be set to 0

This commit is contained in:
Christophe Romain 2015-01-22 12:40:27 +01:00
parent 561025ba32
commit c4d17d939d

View File

@ -61,9 +61,9 @@ get_log_path() ->
-ifdef(LAGER).
get_pos_integer_env(Name, Default) ->
get_integer_env(Name, Default) ->
case application:get_env(ejabberd, Name) of
{ok, I} when is_integer(I), I>0 ->
{ok, I} when is_integer(I), I>=0 ->
I;
undefined ->
Default;
@ -73,7 +73,7 @@ get_pos_integer_env(Name, Default) ->
[Name, Junk, Default]),
Default
end.
get_pos_string_env(Name, Default) ->
get_string_env(Name, Default) ->
case application:get_env(ejabberd, Name) of
{ok, L} when is_list(L) ->
L;
@ -94,10 +94,10 @@ start() ->
Dir = filename:dirname(ConsoleLog),
ErrorLog = filename:join([Dir, "error.log"]),
CrashLog = filename:join([Dir, "crash.log"]),
LogRotateDate = get_pos_string_env(log_rotate_date, ""),
LogRotateSize = get_pos_integer_env(log_rotate_size, 10*1024*1024),
LogRotateCount = get_pos_integer_env(log_rotate_count, 1),
LogRateLimit = get_pos_integer_env(log_rate_limit, 100),
LogRotateDate = get_string_env(log_rotate_date, ""),
LogRotateSize = get_integer_env(log_rotate_size, 10*1024*1024),
LogRotateCount = get_integer_env(log_rotate_count, 1),
LogRateLimit = get_integer_env(log_rate_limit, 100),
application:set_env(lager, error_logger_hwm, LogRateLimit),
application:set_env(
lager, handlers,