util/datamanager.lua
changeset 7000 0ab228bc21c6
parent 6999 644b1bddc676
child 7001 86607fe755b6
--- a/util/datamanager.lua	Fri Dec 11 20:22:54 2015 +0100
+++ b/util/datamanager.lua	Fri Dec 11 20:24:36 2015 +0100
@@ -222,7 +222,16 @@
 	end
 	local pos = f:seek("end");
 	ok, msg = fallocate(f, pos, #data);
-	f:seek("set", pos);
+	if not ok then
+		log("warn", "fallocate() failed: %s", tostring(msg));
+		-- This doesn't work on every file system
+	end
+
+	if f:seek() ~= pos then
+		log("debug", "fallocate() changed file position");
+		f:seek("set", pos);
+	end
+
 	if ok then
 		f:write(data);
 	else