aboutsummaryrefslogtreecommitdiffstats
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
commitc3aae40b197b00014765a5dcc2874e4483a5d6dc (patch)
tree4d18ec72cf7237e5e46f9bd20cbbe2474c932597
parentf0c676e8c6e714fcdd898c913af0b705ccde61ee (diff)
downloadprosody-c3aae40b197b00014765a5dcc2874e4483a5d6dc.tar.gz
prosody-c3aae40b197b00014765a5dcc2874e4483a5d6dc.zip
util.datamanager: Use atomic store function when writing the first entry of a list
-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");