summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-18 03:09:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-18 03:09:39 +0000
commit456dc174b644251a264cf05016ebb31ee01f63f2 (patch)
tree06dcc4331c01349e7452435ad0b20814e2e23abf /lib
parentfa5870b9c4f530bf2bd497ca9aacf922489ce405 (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/resolv.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb
index 3df88e4f9c..830ba160d2 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -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