summaryrefslogtreecommitdiffhomepage
path: root/libs/core/luasrc/ccache.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/core/luasrc/ccache.lua
parent2baab00b19fc6eb4e0aca4da035292e37d94a640 (diff)
Drop support for luaposix and bitlib (obsoleted by nixio)
Mark luci.fs as deprecated
Diffstat (limited to 'libs/core/luasrc/ccache.lua')
-rw-r--r--libs/core/luasrc/ccache.lua15
1 files changed, 8 insertions, 7 deletions
diff --git a/libs/core/luasrc/ccache.lua b/libs/core/luasrc/ccache.lua
index 83e82d9fd..c9771af21 100644
--- a/libs/core/luasrc/ccache.lua
+++ b/libs/core/luasrc/ccache.lua
@@ -14,8 +14,9 @@ $Id$
]]--
local io = require "io"
+local fs = require "nixio.fs"
local util = require "luci.util"
-local posix = require "posix"
+local nixio = require "nixio"
local debug = require "debug"
local string = require "string"
local package = require "package"
@@ -36,10 +37,10 @@ function cache_enable(cachepath, mode)
mode = mode or "r--r--r--"
local loader = package.loaders[2]
- local uid = posix.getpid("uid")
+ local uid = nixio.getpid("uid")
- if not posix.stat(cachepath) then
- posix.mkdir(cachepath)
+ if not fs.stat(cachepath) then
+ fs.mkdir(cachepath)
end
local function _encode_filename(name)
@@ -51,19 +52,19 @@ function cache_enable(cachepath, mode)
end
local function _load_sane(file)
- local stat = posix.stat(file)
+ local stat = fs.stat(file)
if stat and stat.uid == uid and stat.mode == mode then
return loadfile(file)
end
end
local function _write_sane(file, func)
- if posix.getpid("uid") == uid then
+ if nixio.getuid() == uid then
local fp = io.open(file, "w")
if fp then
fp:write(util.get_bytecode(func))
fp:close()
- posix.chmod(file, mode)
+ fs.chmod(file, mode)
end
end
end