File 1163-Allow-to-refresh-resolver-settings-on-startup.patch of Package erlang

From 770c581cbe87706d2879025dfd3ea900933ed5e1 Mon Sep 17 00:00:00 2001
From: Michal Ptaszek <michal@ptaszek.net>
Date: Thu, 28 Jan 2016 15:09:16 -0600
Subject: [PATCH 1/2] 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.
---
 lib/kernel/src/inet_db.erl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/kernel/src/inet_db.erl b/lib/kernel/src/inet_db.erl
index 108a803..7278ec4 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("");
-- 
2.1.4

openSUSE Build Service is sponsored by