diff options
author | Kim Alvefur <zash@zash.se> | 2015-12-11 20:29:55 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-12-11 20:29:55 +0100 |
commit | 25a50fa01abd5e64f203b4ec9c47f9113998d030 (patch) | |
tree | abd8bbac84e2a41c5e8238b38c39092c0fedc2db /util/datamanager.lua | |
parent | 1099fb8dd73854dcf77e618378034869ca096638 (diff) | |
download | prosody-25a50fa01abd5e64f203b4ec9c47f9113998d030.tar.gz prosody-25a50fa01abd5e64f203b4ec9c47f9113998d030.zip |
util.datamanager: Add some comments about the append function
Diffstat (limited to 'util/datamanager.lua')
-rw-r--r-- | util/datamanager.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua index ce4c5b5a..510c0161 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -209,17 +209,20 @@ local function store(username, host, datastore, data) return true; end +-- Append a blob of data to a file local function append(username, host, datastore, ext, data) local filename = getpath(username, host, datastore, ext, true); local ok; local f, msg = io_open(filename, "r+"); if not f then + -- File did probably not exist, let's create it f, msg = io_open(filename, "w"); if not f then return nil, msg; end end + local pos = f:seek("end"); ok, msg = fallocate(f, pos, #data); if not ok then |