util.datamanager: Add some comments about the append function
authorKim Alvefur <zash@zash.se>
Fri, 11 Dec 2015 20:29:55 +0100
changeset 7002 0ad66d12113a
parent 7001 86607fe755b6
child 7003 2b57f77985a3
util.datamanager: Add some comments about the append function
util/datamanager.lua
--- a/util/datamanager.lua	Fri Dec 11 20:26:04 2015 +0100
+++ b/util/datamanager.lua	Fri Dec 11 20:29:55 2015 +0100
@@ -209,17 +209,20 @@
 	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