projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge 0.9->0.10
[prosody.git]
/
util
/
datamanager.lua
diff --git
a/util/datamanager.lua
b/util/datamanager.lua
index 510c0161aca948f6a0546ebb2cc8d7b1929a5b8d..83f3dd13042d7607c8d5c2144a18f7512b4ec641 100644
(file)
--- a/
util/datamanager.lua
+++ b/
util/datamanager.lua
@@
-211,6
+211,7
@@
end
-- Append a blob of data to a file
local function append(username, host, datastore, ext, data)
-- Append a blob of data to a file
local function append(username, host, datastore, ext, data)
+ if type(data) ~= "string" then return; end
local filename = getpath(username, host, datastore, ext, true);
local ok;
local filename = getpath(username, host, datastore, ext, true);
local ok;
@@
-219,7
+220,7
@@
local function append(username, host, datastore, ext, data)
-- File did probably not exist, let's create it
f, msg = io_open(filename, "w");
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;
+ return nil, msg
, "open"
;
end
end
end
end
@@
-238,7
+239,7
@@
local function append(username, host, datastore, ext, data)
ok, msg = f:write(data);
if not ok then
f:close();
ok, msg = f:write(data);
if not ok then
f:close();
- return ok, msg;
+ return ok, msg
, "write"
;
end
ok, msg = f:close();
end
ok, msg = f:close();
@@
-246,7
+247,7
@@
local function append(username, host, datastore, ext, data)
return ok, msg;
end
return ok, msg;
end
- return true;
+ return true
, pos
;
end
local function list_append(username, host, datastore, data)
end
local function list_append(username, host, datastore, data)
@@
-401,6
+402,7
@@
return {
getpath = getpath;
load = load;
store = store;
getpath = getpath;
load = load;
store = store;
+ append_raw = append;
list_append = list_append;
list_store = list_store;
list_load = list_load;
list_append = list_append;
list_store = list_store;
list_load = list_load;