aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichal Ptaszek <[email protected]>2016-01-28 15:09:16 -0600
committerMichal Ptaszek <[email protected]>2016-01-28 16:33:48 -0600
commit770c581cbe87706d2879025dfd3ea900933ed5e1 (patch)
tree216950873c8ab1dacd7371ccf17eae78eccc7f6a /lib
parentca2783b4da2ee17ed655244ea7460dc11207e563 (diff)
downloadotp-770c581cbe87706d2879025dfd3ea900933ed5e1.tar.gz
otp-770c581cbe87706d2879025dfd3ea900933ed5e1.tar.bz2
otp-770c581cbe87706d2879025dfd3ea900933ed5e1.zip
Allow to refresh resolver settings on startup
After the VM time changes inet_db:times/0 instead of returning number of seconds since 1970, returns number of seconds since the VM start. As a result, if inet_res:lookup is called right after the system start, the condition for re-reading /etc/resolv.conf will not be met (time difference between last access: 0, and the value returned from inet_db:times/0 -> [0-5) is lower than 5 seconds) and no nameservers will be used. This patch allows /etc/resolv.conf to be read immediately after the system is started.
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/src/inet_db.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/kernel/src/inet_db.erl b/lib/kernel/src/inet_db.erl
index 108a803610..7278ec460d 100644
--- a/lib/kernel/src/inet_db.erl
+++ b/lib/kernel/src/inet_db.erl
@@ -514,7 +514,8 @@ res_update(Tag, TagTm, TagInfo, TagSetTm, SetFun) ->
undefined -> ok;
TM ->
case times() of
- Now when Now >= TM + ?RES_FILE_UPDATE_TM ->
+ Now when Now >= TM + ?RES_FILE_UPDATE_TM;
+ (TM =:= 0 andalso Now < ?RES_FILE_UPDATE_TM) ->
case db_get(Tag) of
undefined ->
SetFun("");