aboutsummaryrefslogtreecommitdiffstats
path: root/util
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
commitb84e883632942bc98524a80d02522150b2204b43 (patch)
tree08a6ec94b0740736361418e0eeed54ccb7486547 /util
parentc1fdd165bed28e7914d406938c278d811ef2bd65 (diff)
parent184e6cad288c8d51ed5a9eda5b9c7d378317fad2 (diff)
downloadprosody-b84e883632942bc98524a80d02522150b2204b43.tar.gz
prosody-b84e883632942bc98524a80d02522150b2204b43.zip
Merge 0.9->trunk
Diffstat (limited to 'util')
-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"