aboutsummaryrefslogtreecommitdiffstats
path: root/util/datamanager.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-03-01 17:15:56 +0100
committerKim Alvefur <zash@zash.se>2017-03-01 17:15:56 +0100
commitc0c7406558c6b1af66341da2beeab9c2f0317737 (patch)
tree4d18ec72cf7237e5e46f9bd20cbbe2474c932597 /util/datamanager.lua
parented6045747c843b8c94ceb899a0dff5477d59e891 (diff)
downloadprosody-c0c7406558c6b1af66341da2beeab9c2f0317737.tar.gz
prosody-c0c7406558c6b1af66341da2beeab9c2f0317737.zip
util.datamanager: Use atomic store function when writing the first entry of a list
Diffstat (limited to 'util/datamanager.lua')
-rw-r--r--util/datamanager.lua5
1 files changed, 1 insertions, 4 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua
index 8ef3c050..d36865d7 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -228,11 +228,8 @@ local function append(username, host, datastore, ext, data)
local ok;
local f, msg = io_open(filename, "r+");
if not f then
+ return atomic_store(filename, data);
-- File did probably not exist, let's create it
- f, msg = io_open(filename, "w");
- if not f then
- return nil, msg, "open";
- end
end
local pos = f:seek("end");