aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-03-13 11:48:07 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-03-13 11:48:07 -0300
commita7bda31a720167607f608ba02a7b151bb744c28e (patch)
treedb83e749ff0fc2fff32aa06f69a5d54ba8997b7b /src
parent26f73f0e536c3f0e2dcfc718bebee80bffbb85d1 (diff)
downloadluarocks-a7bda31a720167607f608ba02a7b151bb744c28e.tar.gz
luarocks-a7bda31a720167607f608ba02a7b151bb744c28e.tar.bz2
luarocks-a7bda31a720167607f608ba02a7b151bb744c28e.zip
Use posix.mkdtemp conditionally
Closes #677.
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/fs/lua.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua
index 8fe2466c..89426b09 100644
--- a/src/luarocks/fs/lua.lua
+++ b/src/luarocks/fs/lua.lua
@@ -9,7 +9,6 @@ local fs = require("luarocks.fs")
9local cfg = require("luarocks.core.cfg") 9local cfg = require("luarocks.core.cfg")
10local dir = require("luarocks.dir") 10local dir = require("luarocks.dir")
11local util = require("luarocks.util") 11local util = require("luarocks.util")
12local path = require("luarocks.path")
13 12
14local socket_ok, zip_ok, unzip_ok, lfs_ok, md5_ok, posix_ok, _ 13local socket_ok, zip_ok, unzip_ok, lfs_ok, md5_ok, posix_ok, _
15local http, ftp, lrzip, luazip, lfs, md5, posix 14local http, ftp, lrzip, luazip, lfs, md5, posix
@@ -788,6 +787,9 @@ function fs_lua.current_user()
788 return posix.getpwuid(posix.geteuid()).pw_name 787 return posix.getpwuid(posix.geteuid()).pw_name
789end 788end
790 789
790-- This call is not available on all systems, see #677
791if posix.mkdtemp then
792
791--- Create a temporary directory. 793--- Create a temporary directory.
792-- @param name string: name pattern to use for avoiding conflicts 794-- @param name string: name pattern to use for avoiding conflicts
793-- when creating temporary directory. 795-- when creating temporary directory.
@@ -799,6 +801,8 @@ function fs_lua.make_temp_dir(name)
799 return posix.mkdtemp((os.getenv("TMPDIR") or "/tmp") .. "/luarocks_" .. name:gsub("/", "_") .. "-XXXXXX") 801 return posix.mkdtemp((os.getenv("TMPDIR") or "/tmp") .. "/luarocks_" .. name:gsub("/", "_") .. "-XXXXXX")
800end 802end
801 803
804end -- if posix.mkdtemp
805
802end 806end
803 807
804--------------------------------------------------------------------- 808---------------------------------------------------------------------