aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-12-11 20:26:04 +0100
committerKim Alvefur <zash@zash.se>2015-12-11 20:26:04 +0100
commit1099fb8dd73854dcf77e618378034869ca096638 (patch)
tree329f3ec36bd71b4d0fcd1630b446d0644fcd3d51
parent93304d3439bdf8479bf24971487275432045dd41 (diff)
downloadprosody-1099fb8dd73854dcf77e618378034869ca096638.tar.gz
prosody-1099fb8dd73854dcf77e618378034869ca096638.zip
util.datamanager: Handle potential error from :write() call
-rw-r--r--util/datamanager.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua
index 3016feed..ce4c5b5a 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -232,9 +232,9 @@ local function append(username, host, datastore, ext, data)
f:seek("set", pos);
end
- if ok then
- f:write(data);
- else
+ ok, msg = f:write(data);
+ if not ok then
+ f:close();
return ok, msg;
end