aboutsummaryrefslogtreecommitdiffstats
path: root/util/datamanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2012-09-12 22:03:57 +0500
committerWaqas Hussain <waqas20@gmail.com>2012-09-12 22:03:57 +0500
commit543b3a5e807c88050d8cf277eacc9aa0eb46f5d7 (patch)
tree08a6ec94b0740736361418e0eeed54ccb7486547 /util/datamanager.lua
parent955f9b6e14b048498925a14a3be97adc025f6c2c (diff)
parenta79c507ade52c12c691a1eb79fbf80f0cba5be77 (diff)
downloadprosody-543b3a5e807c88050d8cf277eacc9aa0eb46f5d7.tar.gz
prosody-543b3a5e807c88050d8cf277eacc9aa0eb46f5d7.zip
Merge 0.9->trunk
Diffstat (limited to 'util/datamanager.lua')
-rw-r--r--util/datamanager.lua35
1 files changed, 15 insertions, 20 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua
index 17c614ed..e6ad86db 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -25,28 +25,23 @@ local serialize = require "util.serialization".serialize;
local path_separator = assert ( package.config:match ( "^([^\n]+)" ) , "package.config not in standard form" ) -- Extract directory seperator from package.config (an undocumented string that comes with lua)
local lfs = require "lfs";
local prosody = prosody;
-local raw_mkdir;
-local fallocate;
-
-if prosody.platform == "posix" then
- raw_mkdir = require "util.pposix".mkdir; -- Doesn't trample on umask
- fallocate = require "util.pposix".fallocate;
-else
- raw_mkdir = lfs.mkdir;
-end
-if not fallocate then -- Fallback
- function fallocate(f, offset, len)
- -- This assumes that current position == offset
- local fake_data = (" "):rep(len);
- local ok, msg = f:write(fake_data);
- if not ok then
- return ok, msg;
- end
- f:seek("set", offset);
- return true;
+local raw_mkdir = lfs.mkdir;
+local function fallocate(f, offset, len)
+ -- This assumes that current position == offset
+ local fake_data = (" "):rep(len);
+ local ok, msg = f:write(fake_data);
+ if not ok then
+ return ok, msg;
end
-end
+ f:seek("set", offset);
+ return true;
+end;
+pcall(function()
+ local pposix = require "util.pposix";
+ raw_mkdir = pposix.mkdir or raw_mkdir; -- Doesn't trample on umask
+ fallocate = pposix.fallocate or fallocate;
+end);
module "datamanager"