diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-03-13 11:48:07 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-03-13 11:48:07 -0300 |
commit | a7bda31a720167607f608ba02a7b151bb744c28e (patch) | |
tree | db83e749ff0fc2fff32aa06f69a5d54ba8997b7b /src | |
parent | 26f73f0e536c3f0e2dcfc718bebee80bffbb85d1 (diff) | |
download | luarocks-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.lua | 6 |
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") | |||
9 | local cfg = require("luarocks.core.cfg") | 9 | local cfg = require("luarocks.core.cfg") |
10 | local dir = require("luarocks.dir") | 10 | local dir = require("luarocks.dir") |
11 | local util = require("luarocks.util") | 11 | local util = require("luarocks.util") |
12 | local path = require("luarocks.path") | ||
13 | 12 | ||
14 | local socket_ok, zip_ok, unzip_ok, lfs_ok, md5_ok, posix_ok, _ | 13 | local socket_ok, zip_ok, unzip_ok, lfs_ok, md5_ok, posix_ok, _ |
15 | local http, ftp, lrzip, luazip, lfs, md5, posix | 14 | local 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 |
789 | end | 788 | end |
790 | 789 | ||
790 | -- This call is not available on all systems, see #677 | ||
791 | if 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") |
800 | end | 802 | end |
801 | 803 | ||
804 | end -- if posix.mkdtemp | ||
805 | |||
802 | end | 806 | end |
803 | 807 | ||
804 | --------------------------------------------------------------------- | 808 | --------------------------------------------------------------------- |