aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-05-15 15:25:37 +0200
committerKim Alvefur <zash@zash.se>2015-05-15 15:25:37 +0200
commit72be074759b48e715c88c5c880e5f4b523f3ee5d (patch)
tree45ff42efa5b4bf848d8c72995d9471209dd61779
parent09475a58627185035bc27fa64af04ca968b293cd (diff)
downloadprosody-72be074759b48e715c88c5c880e5f4b523f3ee5d.tar.gz
prosody-72be074759b48e715c88c5c880e5f4b523f3ee5d.zip
mod_storage_xep0227: Open file for writing even if removing so os.remove has a file to delete
-rw-r--r--plugins/mod_storage_xep0227.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua
index b41fc6ce..22575fe3 100644
--- a/plugins/mod_storage_xep0227.lua
+++ b/plugins/mod_storage_xep0227.lua
@@ -23,14 +23,15 @@ end
local function setXml(user, host, xml)
local jid = user.."@"..host;
local path = paths.join(prosody.paths.data, jid..".xml");
+ local f = io_open(path, "w");
+ if not f then return; end
if xml then
- local f = io_open(path, "w");
- if not f then return; end
local s = tostring(xml);
f:write(s);
f:close();
return true;
else
+ f:close();
return os_remove(path);
end
end