aboutsummaryrefslogtreecommitdiffstats
path: root/util/datamanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-07-31 23:07:02 +0100
committerMatthew Wild <mwild1@gmail.com>2012-07-31 23:07:02 +0100
commitdb304d412cbb2c4529bc3bf911dcee0747ea9084 (patch)
tree4301677c927a8fa3e7991312c13ee59ab0003a38 /util/datamanager.lua
parent56c30635ccf2c210fbb37e83e28f7d956dc6c74f (diff)
parent5e947f4b086e5818b0aac35fe2bbd2079fbf4077 (diff)
downloadprosody-db304d412cbb2c4529bc3bf911dcee0747ea9084.tar.gz
prosody-db304d412cbb2c4529bc3bf911dcee0747ea9084.zip
Merge Waqas<>Zash
Diffstat (limited to 'util/datamanager.lua')
-rw-r--r--util/datamanager.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua
index c8b905ac..9f7600ee 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -171,6 +171,18 @@ local function atomic_store(filename, data)
return nil, msg;
end
+if prosody.platform ~= "posix" then
+ -- os.rename does not overwrite existing files on Windows
+ -- TODO We could use Transactional NTFS on Vista and above
+ function atomic_store(filename, data)
+ local f, err = io_open(filename, "w");
+ if not f then return f, err; end
+ local ok, msg = f:write(data);
+ if not ok then f:close(); return ok, msg; end
+ return f:close();
+ end
+end
+
function store(username, host, datastore, data)
if not data then
data = {};