aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2010-10-15 02:43:46 -0300
committerHisham Muhammad <hisham@gobolinux.org>2010-10-15 02:43:46 -0300
commitcd45b48e8b9ff3e30fa13ea9b17b6d5a01a4b9d5 (patch)
tree0e7a6220692484d12be36d3ebef3a5709caf3e8c
parenta615146836e373deec0765c643afaeb7409b139d (diff)
downloadluarocks-cd45b48e8b9ff3e30fa13ea9b17b6d5a01a4b9d5.tar.gz
luarocks-cd45b48e8b9ff3e30fa13ea9b17b6d5a01a4b9d5.tar.bz2
luarocks-cd45b48e8b9ff3e30fa13ea9b17b6d5a01a4b9d5.zip
Add sanity check to is_actual_binary.
Should fix crash in 'luarocks pack' reported by Alexander Gladysh, or at least give better diagnostics.
-rw-r--r--src/luarocks/fs/unix.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua
index f2290412..c5769bac 100644
--- a/src/luarocks/fs/unix.lua
+++ b/src/luarocks/fs/unix.lua
@@ -101,6 +101,11 @@ function is_actual_binary(filename)
101 if file then 101 if file then
102 local found = false 102 local found = false
103 local first = file:read() 103 local first = file:read()
104 if not first then
105 file:close()
106 print("Warning: could not read "..filename)
107 return false
108 end
104 if first:match("#!.*lua") then 109 if first:match("#!.*lua") then
105 file:close() 110 file:close()
106 return true 111 return true