libs/core: Fixed luci.fs.isfile
[project/luci.git] / libs / core / luasrc / fs.lua
index 35b8289..7086088 100644 (file)
@@ -27,16 +27,16 @@ limitations under the License.
 module("luci.fs", package.seeall)
 
 require("posix")
-posix.umask("rwx------")
+
+-- Access
+access = posix.access
 
 -- Glob
 glob = posix.glob
 
 -- Checks whether a file exists
 function isfile(filename)
-       local fp = io.open(filename, "r")
-       if fp then fp:close() end
-       return fp ~= nil
+       return posix.stat(filename, "type") == "regular"
 end
 
 -- Returns the content of file