Skip to content

Commit 2ca6c8c

Browse files
committed
Treat hostname as same as aliases
1 parent abeb413 commit 2ca6c8c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/resolv.rb

+5-8
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,13 @@ def lazy_initialize # :nodoc:
194194
File.open(@filename, 'rb') {|f|
195195
f.each {|line|
196196
line.sub!(/#.*/, '')
197-
addr, hostname, *aliases = line.split(/\s+/)
197+
addr, *hostnames = line.split(/\s+/)
198198
next unless addr
199199
@addr2name[addr] = [] unless @addr2name.include? addr
200-
@addr2name[addr] << hostname
201-
@addr2name[addr].concat(aliases)
202-
@name2addr[hostname] = [] unless @name2addr.include? hostname
203-
@name2addr[hostname] << addr
204-
aliases.each {|n|
205-
@name2addr[n] = [] unless @name2addr.include? n
206-
@name2addr[n] << addr
200+
@addr2name[addr].concat(hostnames)
201+
hostnames.each {|hostname|
202+
@name2addr[hostname] = [] unless @name2addr.include? hostname
203+
@name2addr[hostname] << addr
207204
}
208205
}
209206
}

0 commit comments

Comments
 (0)