# HG changeset patch # User Kim Alvefur # Date 1449861876 -3600 # Node ID 0ab228bc21c64956e71e68f1b6ccdb959e36d59a # Parent 644b1bddc676e77f86da5e590bc9dc29a00d7ab2 util.datamanager: Handle potential issues from fallocate diff -r 644b1bddc676 -r 0ab228bc21c6 util/datamanager.lua --- 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