aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2016-04-05 16:12:38 +0200
committerRaimo Niskanen <[email protected]>2016-04-06 09:02:03 +0200
commite8f83e476ffc47d63696ce8a11e71ab6213809c2 (patch)
treed9d7258f06cede007b2a65728cfb669c9b6a6229 /lib/kernel/src
parent770c581cbe87706d2879025dfd3ea900933ed5e1 (diff)
downloadotp-e8f83e476ffc47d63696ce8a11e71ab6213809c2.tar.gz
otp-e8f83e476ffc47d63696ce8a11e71ab6213809c2.tar.bz2
otp-e8f83e476ffc47d63696ce8a11e71ab6213809c2.zip
Fix start timestamp instead of time check
Verify with: erl -noshell -eval 'io:write(inet_res:lookup("localhost",in,a)),io:nl(),init:stop().' Prints: [{127,0,0,1}] Without this correction you will get [] on a hostname that works later after system start.
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/inet_db.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/kernel/src/inet_db.erl b/lib/kernel/src/inet_db.erl
index 7278ec460d..465cec1b45 100644
--- a/lib/kernel/src/inet_db.erl
+++ b/lib/kernel/src/inet_db.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2016. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -514,8 +514,7 @@ res_update(Tag, TagTm, TagInfo, TagSetTm, SetFun) ->
undefined -> ok;
TM ->
case times() of
- Now when Now >= TM + ?RES_FILE_UPDATE_TM;
- (TM =:= 0 andalso Now < ?RES_FILE_UPDATE_TM) ->
+ Now when Now >= TM + ?RES_FILE_UPDATE_TM ->
case db_get(Tag) of
undefined ->
SetFun("");
@@ -1207,7 +1206,8 @@ handle_set_file(Option, Fname, TagTm, TagInfo, ParseFun, From,
File = filename:flatten(Fname),
ets:insert(Db, {res_optname(Option), File}),
ets:insert(Db, {TagInfo, undefined}),
- ets:insert(Db, {TagTm, 0}),
+ TimeZero = - (?RES_FILE_UPDATE_TM + 1), % Early enough
+ ets:insert(Db, {TagTm, TimeZero}),
{reply,ok,State};
true ->
File = filename:flatten(Fname),