aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-23 02:50:57 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-23 02:50:57 +0000
commit246bfb79cc233e8b1dabf007f87b2c6bce13c684 (patch)
treea83a3a9cc73dff2f99b96143bc5eea5471421841 /net
parent30745e65bb73ef1ae92000874a494a6eda428d71 (diff)
downloadprosody-246bfb79cc233e8b1dabf007f87b2c6bce13c684.tar.gz
prosody-246bfb79cc233e8b1dabf007f87b2c6bce13c684.zip
Fix dns for poor Windows users, who have never seen a resolv.conf
Diffstat (limited to 'net')
-rw-r--r--net/dns.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/dns.lua b/net/dns.lua
index a75c1bf5..01ee133c 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -501,7 +501,9 @@ function resolver:setnameserver (address) -- - - - - - - - - - setnameserver
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