aboutsummaryrefslogtreecommitdiffstats
path: root/util
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
commit4b380b1cbfd38a79277c7359b015fbe134c23176 (patch)
tree329f3ec36bd71b4d0fcd1630b446d0644fcd3d51 /util
parentbe1b771edf344615e31f310259b2793c95c1d217 (diff)
downloadprosody-4b380b1cbfd38a79277c7359b015fbe134c23176.tar.gz
prosody-4b380b1cbfd38a79277c7359b015fbe134c23176.zip
util.datamanager: Handle potential error from :write() call
Diffstat (limited to 'util')
-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