diff options
author | Ted Trask <ttrask01@yahoo.com> | 2015-05-11 10:05:26 -0400 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2015-05-11 10:05:26 -0400 |
commit | 4d3d351fface621896b510df7acc33e8ff3c60dc (patch) | |
tree | 64796ed247212821d7143dd74d95635b4e24a88b | |
parent | d93ee8df55aa6b41b043614cfae5c3805dac11c9 (diff) | |
download | acf-alpine-baselayout-4d3d351fface621896b510df7acc33e8ff3c60dc.tar.bz2 acf-alpine-baselayout-4d3d351fface621896b510df7acc33e8ff3c60dc.tar.xz |
Revert "Fix exception in logfile-model due to change to luaposix API"
This reverts commit d93ee8df55aa6b41b043614cfae5c3805dac11c9.
-rw-r--r-- | logfiles-model.lua | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/logfiles-model.lua b/logfiles-model.lua index 9fa36e7..590b3ae 100644 --- a/logfiles-model.lua +++ b/logfiles-model.lua @@ -1,8 +1,7 @@ -- acf model for displaying logfiles local mymodule = {} -dirent = require("posix.dirent") -unistd = require("posix.unistd") +posix = require("posix") modelfunctions = require("modelfunctions") fs = require("acf.fs") format = require("acf.format") @@ -12,12 +11,7 @@ local function file_info ( path ) -- Check if file is in use local st = fs.stat(path) while st.type == "link" do - local ok,link = pcall(unistd.readlink, st.path) - if ok and link then - st = fs.stat(link) - else - break - end + st = fs.stat(posix.readlink(st.path)) end local size = st.size or "0" local lastmod = st.mtime or "---" @@ -30,23 +24,14 @@ end local function recursedir(path, filearray) filearray = filearray or {} local k,v - local ok, files = pcall(dirent.dir, path) - if not ok then - return {} - end - for k,v in pairs(files) do + for k,v in pairs(posix.dir(path) or {}) do -- Ignore files that begins with a '.' if not string.match(v, "^%.") then local f = path .. "/" .. v -- If subfolder exists, list files in this subfolder local st = fs.stat(f) while st and st.type == "link" do - local ok,link = pcall(unistd.readlink, st.path) - if ok and link then - st = fs.stat(link) - else - break - end + st = fs.stat(posix.readlink(st.path)) end if st and st.type == "directory" then recursedir(f, filearray) @@ -108,12 +93,7 @@ mymodule.get_filedetails = function (path, grep) if success then local st = fs.stat(path) while st.type == "link" do - local ok,link = pcall(unistd.readlink, st.path) - if ok and link then - st = fs.stat(link) - else - break - end + st = fs.stat(posix.readlink(st.path)) end file = st.path end @@ -190,12 +170,7 @@ mymodule.delete = function (self, filetodelete) else local st = fs.stat(filetodelete.value.filename.value) while st.type == "link" do - local ok,link = pcall(unistd.readlink, st.path) - if ok and link then - st = fs.stat(link) - else - break - end + st = fs.stat(posix.readlink(st.path)) end local status, err = os.remove( st.path ) if err then |