diff options
Diffstat (limited to 'openntpd-model.lua')
-rw-r--r-- | openntpd-model.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/openntpd-model.lua b/openntpd-model.lua index a66160c..cbb0ab7 100644 --- a/openntpd-model.lua +++ b/openntpd-model.lua @@ -72,7 +72,7 @@ function read_config () config.listen = cfe({ type="list", value={}, label="Addresses to listen on", descr="List of IP addresses/hostnames to listen on. '*' means listen on all local addresses." }) config.setstimeonstartup = cfe({ type="boolean", value=false, label="Set time on startup" }) - local conf = format.parse_linesandwords(fs.read_file(configfile)) + local conf = format.parse_linesandwords(fs.read_file(configfile) or "") for i,line in ipairs(conf) do if line[1] == "server" then table.insert(config.server.value, line[2]) @@ -83,7 +83,7 @@ function read_config () end end - local opts = string.sub(format.parse_ini_file(fs.read_file(confdfile), "", "NTPD_OPTS"), 2, -2) + local opts = string.sub(format.parse_ini_file(fs.read_file(confdfile) or "", "", "NTPD_OPTS"), 2, -2) if format.opts_to_table(opts, "-s") then config.setstimeonstartup.value = true end @@ -99,7 +99,7 @@ function update_config(config) local reverseservers = {} for i,val in ipairs(config.value.servers.value) do reverseservers[val] = i end local reverselisten = {} for i,val in ipairs(config.value.listen.value) do reverselisten[val] = i end - local configcontent = string.gsub(fs.read_file(configfile), "\n+$", "") + local configcontent = string.gsub(fs.read_file(configfile) or "", "\n+$", "") local configlines = format.parse_linesandwords(configcontent) for i=#configlines,1,-1 do if configlines[i][1] == "server" then |