1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

resolv.rb: NUL hosts

* lib/resolv.rb (Resolv::Hosts::DefaultFileName): fallback to NUL
  device when Win32::Resolv.get_hosts_path() returned nil, to get
  rid of TypeError in lazy_initialize.
  [ruby-core:84907] [Bug #14369]  [Fix GH-1791]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-01-18 03:09:39 +00:00
parent fa5870b9c4
commit 456dc174b6

View file

@ -169,7 +169,7 @@ class Resolv
begin
raise LoadError unless /mswin|mingw|cygwin/ =~ RUBY_PLATFORM
require 'win32/resolv'
DefaultFileName = Win32::Resolv.get_hosts_path
DefaultFileName = Win32::Resolv.get_hosts_path || IO::NULL
rescue LoadError
DefaultFileName = '/etc/hosts'
end