diff options
author | Kim Alvefur <zash@zash.se> | 2015-05-13 21:44:13 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-05-13 21:44:13 +0200 |
commit | 8389ecb795287b1d0c053c76bb0e65badd48c2a6 (patch) | |
tree | e029296b2697abfa1d3b9a448fe51e725dadf507 /util/datamanager.lua | |
parent | c22dec3f1c5a28dcb7d71ecf16b48b545d1e5423 (diff) | |
download | prosody-8389ecb795287b1d0c053c76bb0e65badd48c2a6.tar.gz prosody-8389ecb795287b1d0c053c76bb0e65badd48c2a6.zip |
util.datamanager: Fix traceback from trying to purge when storage is empty or otherwise unaccessible (fixes #496)
Diffstat (limited to 'util/datamanager.lua')
-rw-r--r-- | util/datamanager.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua index b4138638..a107d95c 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -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)); |