Fix dns for poor Windows users, who have never seen a resolv.conf

Sun, 23 Nov 2008 02:50:57 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 23 Nov 2008 02:50:57 +0000
changeset 378
47fdbd074641
parent 377
12f483fe534b
child 379
c5617678cd7b

Fix dns for poor Windows users, who have never seen a resolv.conf

net/dns.lua file | annotate | diff | comparison | revisions
--- a/net/dns.lua	Sun Nov 23 02:42:21 2008 +0000
+++ b/net/dns.lua	Sun Nov 23 02:50:57 2008 +0000
@@ -501,7 +501,9 @@
 
 
 function resolver:adddefaultnameservers ()    -- - - - -  adddefaultnameservers
-  for line in io.lines ('/etc/resolv.conf') do
+  local resolv_conf = io.open("/etc/resolv.conf");
+  if not resolv_conf then return nil; end
+  for line in resolv_conf:lines() do
     address = string.match (line, 'nameserver%s+(%d+%.%d+%.%d+%.%d+)')
     if address then  self:addnameserver (address)  end
     end  end

mercurial