Software /
code /
prosody
Changeset
1827:fc21e8832848
net.dns: Even better parsing of nameservers from resolv.conf
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 25 Sep 2009 01:35:46 +0100 |
parents | 1822:2f78ea5d0f11 |
children | 1828:48cb27e2716e 1831:ced7a6b8bcd0 |
files | net/dns.lua |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/net/dns.lua Thu Sep 24 23:46:12 2009 +0100 +++ b/net/dns.lua Fri Sep 25 01:35:46 2009 +0100 @@ -510,7 +510,7 @@ local resolv_conf = io.open("/etc/resolv.conf"); if resolv_conf then for line in resolv_conf:lines() do - local address = string.match (line, '^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$') + local address = line:gsub("#.*$", ""):match('^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$') if address then self:addnameserver (address) end end elseif os.getenv("WINDIR") then