projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1c692c6
)
util.datamanager: Handle potential issues from fallocate
author
Kim Alvefur
<zash@zash.se>
Fri, 11 Dec 2015 19:24:36 +0000
(20:24 +0100)
committer
Kim Alvefur
<zash@zash.se>
Fri, 11 Dec 2015 19:24:36 +0000
(20:24 +0100)
util/datamanager.lua
patch
|
blob
|
history
diff --git
a/util/datamanager.lua
b/util/datamanager.lua
index 786abd956381193c7e4b9c87093d375ebd499cd0..3016feed8beb224ba79bfbc666615ec72a825393 100644
(file)
--- 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