aboutsummaryrefslogtreecommitdiffstats
path: root/util/datamanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-12-10 00:21:09 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-12-10 00:21:09 +0500
commitfc496f1fd16145dfb463a306808bf128d6a755ab (patch)
tree5cbcc92f7f13dafd7c2b1ac66adea3726eda8e95 /util/datamanager.lua
parent514ba129d7f48f774e8dc666b612364114bb0ea2 (diff)
downloadprosody-fc496f1fd16145dfb463a306808bf128d6a755ab.tar.gz
prosody-fc496f1fd16145dfb463a306808bf128d6a755ab.zip
util.datamanager: When failing to load a list file, and the file exists, log an error, and return nil, error.
Diffstat (limited to 'util/datamanager.lua')
-rw-r--r--util/datamanager.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua
index 57cd2594..dfb74a63 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -204,8 +204,15 @@ end
function list_load(username, host, datastore)
local data, ret = loadfile(getpath(username, host, datastore, "list"));
if not data then
- log("debug", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil"));
- return nil;
+ local mode = lfs.attributes(getpath(username, host, datastore, "list"), "mode");
+ if not mode then
+ log("debug", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ return nil;
+ else -- file exists, but can't be read
+ -- TODO more detailed error checking and logging?
+ log("error", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil"));
+ return nil, "Error reading storage";
+ end
end
local items = {};
setfenv(data, {item = function(i) t_insert(items, i); end});