Diff

net/dns.lua @ 378:47fdbd074641

Fix dns for poor Windows users, who have never seen a resolv.conf
author Matthew Wild <mwild1@gmail.com>
date Sun, 23 Nov 2008 02:50:57 +0000
parent 337:4a1dd1c2c219
child 379:c5617678cd7b
line wrap: on
line diff
--- 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