diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2010-10-15 02:43:46 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2010-10-15 02:43:46 -0300 |
commit | cd45b48e8b9ff3e30fa13ea9b17b6d5a01a4b9d5 (patch) | |
tree | 0e7a6220692484d12be36d3ebef3a5709caf3e8c | |
parent | a615146836e373deec0765c643afaeb7409b139d (diff) | |
download | luarocks-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.lua | 5 |
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 |