diff options
author | Kim Alvefur <zash@zash.se> | 2015-12-11 20:24:36 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-12-11 20:24:36 +0100 |
commit | 93304d3439bdf8479bf24971487275432045dd41 (patch) | |
tree | 0d3e34d019b95724892a06cee3aafe30564c9b73 /util | |
parent | da98f6463936788e85bff956434c308f6bb66058 (diff) | |
download | prosody-93304d3439bdf8479bf24971487275432045dd41.tar.gz prosody-93304d3439bdf8479bf24971487275432045dd41.zip |
util.datamanager: Handle potential issues from fallocate
Diffstat (limited to 'util')
-rw-r--r-- | util/datamanager.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua index 786abd95..3016feed 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -222,7 +222,16 @@ local function append(username, host, datastore, ext, data) 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 |