aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-03-22 20:50:37 +0000
committerMatthew Wild <mwild1@gmail.com>2009-03-22 20:50:37 +0000
commit39ac97e87a619d1f52f0806125a6f1df903bd5f1 (patch)
tree4e9d2b5be126a38d173a3726141124ff322ddf3c /util
parent7a764ade59a607930f9761e0d6be618b382097ce (diff)
downloadprosody-39ac97e87a619d1f52f0806125a6f1df903bd5f1.tar.gz
prosody-39ac97e87a619d1f52f0806125a6f1df903bd5f1.zip
util.datamanager: Don't delete data when first entry in table is 'false'. My favourite bug so far.
Diffstat (limited to 'util')
-rw-r--r--util/datamanager.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua
index 9d3c8592..f67c8864 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -102,7 +102,8 @@ function store(username, host, datastore, data)
f:write("return ");
append(f, data);
f:close();
- if not next(data) then -- try to delete empty datastore
+ if next(data) == nil then -- try to delete empty datastore
+ log("debug", "Removing empty %s datastore for user %s@%s", datastore, username, host);
os_remove(getpath(username, host, datastore));
end
-- we write data even when we are deleting because lua doesn't have a
@@ -141,7 +142,8 @@ function list_store(username, host, datastore, data)
f:write(");\n");
end
f:close();
- if not next(data) then -- try to delete empty datastore
+ if next(data) == nil then -- try to delete empty datastore
+ log("debug", "Removing empty %s datastore for user %s@%s", datastore, username, host);
os_remove(getpath(username, host, datastore, "list"));
end
-- we write data even when we are deleting because lua doesn't have a