projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7d652b5
)
util.datamanager: In append() collect status when closing file handle as it may fail...
author
Kim Alvefur
<zash@zash.se>
Fri, 11 Dec 2015 19:13:37 +0000
(20:13 +0100)
committer
Kim Alvefur
<zash@zash.se>
Fri, 11 Dec 2015 19:13:37 +0000
(20:13 +0100)
util/datamanager.lua
patch
|
blob
|
history
diff --git
a/util/datamanager.lua
b/util/datamanager.lua
index 1993d6a3a035ed2ea78a3da4f5fa9bf2ba76b877..4a371d2ce7652360ac2be1b43875e2f3c16eb788 100644
(file)
--- a/
util/datamanager.lua
+++ b/
util/datamanager.lua
@@
-210,9
+210,10
@@
local function store(username, host, datastore, data)
end
local function append(username, host, datastore, ext, data)
end
local function append(username, host, datastore, ext, data)
- local f, msg = io_open(getpath(username, host, datastore, ext, true), "r+");
+ local filename = getpath(username, host, datastore, ext, true);
+ local f, msg = io_open(filename, "r+");
if not f then
if not f then
- f, msg = io_open(
getpath(username, host, datastore, ext, true)
, "w");
+ f, msg = io_open(
filename
, "w");
end
if not f then
return nil, msg;
end
if not f then
return nil, msg;
@@
-225,7
+226,12
@@
local function append(username, host, datastore, ext, data)
else
return ok, msg;
end
else
return ok, msg;
end
- f:close();
+
+ ok, msg = f:close();
+ if not ok then
+ return ok, msg;
+ end
+
return true;
end
return true;
end