# HG changeset patch # User Matthew Wild # Date 1253838946 -3600 # Node ID fc21e8832848c9ed84bef2c5a7e88e692e945f7a # Parent 2f78ea5d0f112d01c1e428688a71afc620648545 net.dns: Even better parsing of nameservers from resolv.conf diff -r 2f78ea5d0f11 -r fc21e8832848 net/dns.lua --- 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