File 1164-Fix-start-timestamp-instead-of-time-check.patch of Package erlang
From e8f83e476ffc47d63696ce8a11e71ab6213809c2 Mon Sep 17 00:00:00 2001
From: Raimo Niskanen <raimo@erlang.org>
Date: Tue, 5 Apr 2016 16:12:38 +0200
Subject: [PATCH 2/2] 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.
---
lib/kernel/src/inet_db.erl | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/kernel/src/inet_db.erl b/lib/kernel/src/inet_db.erl
index 7278ec4..465cec1 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),
--
2.1.4