Changeset

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
parents 377:12f483fe534b
children 379:c5617678cd7b
files net/dns.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
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