summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/template.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-06-21 13:42:26 +0000
committerSteven Barth <steven@midlink.org>2009-06-21 13:42:26 +0000
commit30b216f774c2404a965807ddb93a4a4b2aaeac04 (patch)
tree2d4bbdadc263f495e358af0fda9baf5b02274c3b /libs/web/luasrc/template.lua
parent2baab00b19fc6eb4e0aca4da035292e37d94a640 (diff)
Drop support for luaposix and bitlib (obsoleted by nixio)
Mark luci.fs as deprecated
Diffstat (limited to 'libs/web/luasrc/template.lua')
-rw-r--r--libs/web/luasrc/template.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/libs/web/luasrc/template.lua b/libs/web/luasrc/template.lua
index dc6e5bb7dd..83efd22009 100644
--- a/libs/web/luasrc/template.lua
+++ b/libs/web/luasrc/template.lua
@@ -31,6 +31,7 @@ local table = require "table"
local string = require "string"
local config = require "luci.config"
local coroutine = require "coroutine"
+local nixio = require "nixio", require "nixio.util"
local tostring, pairs, loadstring = tostring, pairs, loadstring
local setmetatable, loadfile = setmetatable, loadfile
@@ -177,7 +178,7 @@ function Template.__init__(self, name)
if not fs.mtime(cdir) then
fs.mkdir(cdir, true)
- fs.chmod(fs.dirname(cdir), "a+rxw")
+ fs.chmod(fs.dirname(cdir), 777)
end
assert(tplmt or commt, "No such template: " .. name)
@@ -190,14 +191,15 @@ function Template.__init__(self, name)
if source then
local compiled, err = compile(source)
- fs.writefile(compiledfile, util.get_bytecode(compiled))
- fs.chmod(compiledfile, "a-rwx,u+rw")
+ local f = nixio.open(compiledfile, "w", 600)
+ f:writeall(util.get_bytecode(compiled))
+ f:close()
self.template = compiled
end
else
assert(
sys.process.info("uid") == fs.stat(compiledfile, "uid")
- and fs.stat(compiledfile, "mode") == "rw-------",
+ and fs.stat(compiledfile, "modestr") == "rw-------",
"Fatal: Cachefile is not sane!"
)
self.template, err = loadfile(compiledfile)