Changeset

7928:9d014aca766f

util.datamanager: Use atomic store function when writing the first entry of a list
author Kim Alvefur <zash@zash.se>
date Wed, 01 Mar 2017 17:15:56 +0100
parents 7927:7132abcf669e
children 7929:4017ea6d2599
files util/datamanager.lua
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/util/datamanager.lua	Wed Mar 01 17:04:48 2017 +0100
+++ b/util/datamanager.lua	Wed Mar 01 17:15:56 2017 +0100
@@ -228,11 +228,8 @@
 	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");