From 7a9bfd8dae3a1611366fc42b06f7ec34bc5347d6 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 16 Feb 2024 22:42:57 -0300 Subject: fix: avoid cross-device links Fixes #1559 --- src/luarocks/fs/unix/tools.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index 7106ed81..42e22060 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua @@ -318,10 +318,7 @@ end function tools.lock_access(dirname, force) fs.make_dir(dirname) - local tempfile = os.tmpname() - if not tempfile then - return nil, "failed creating temp file for locking" - end + local tempfile = dir.path(dirname, ".lock.tmp." .. tostring(math.random(100000000))) local fd, fderr = io.open(tempfile, "w") if not fd then -- cgit v1.2.3-55-g6feb