X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fdatamanager.lua;h=a107d95c26904a697a949157f8caa706ca46a696;hb=533fc1fa57ce10fc0821f8edaeb247f2710a543c;hp=b82349f10957bd31d186cb00664902adce63784f;hpb=77fae98e80a674dd791fbb59ebfb0f1916ab4091;p=prosody.git diff --git a/util/datamanager.lua b/util/datamanager.lua index b82349f1..a107d95c 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -293,7 +293,7 @@ function users(host, store, typ) local mode, err = lfs.attributes(store_dir, "mode"); if not mode then - return function() log("debug", err or (store_dir .. " does not exist")) end + return function() log("debug", "%s", err or (store_dir .. " does not exist")) end end local next, state = lfs.dir(store_dir); return function(state) @@ -348,8 +348,12 @@ end function purge(username, host) local host_dir = format("%s/%s/", data_path, encode(host)); + local ok, iter, state, var = pcall(lfs.dir, host_dir); + if not ok then + return ok, iter; + end local errs = {}; - for file in lfs.dir(host_dir) do + for file in iter, state, var do if lfs.attributes(host_dir..file, "mode") == "directory" then local store = decode(file); local ok, err = do_remove(getpath(username, host, store));