From 7849616e0d9c68b2cd15dfc8264a538f81dc28f4 Mon Sep 17 00:00:00 2001 From: Ignacio Burgueño Date: Wed, 29 Jun 2011 20:37:21 -0300 Subject: Read the whole file at once --- src/luarocks/tools/zip.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/luarocks/tools/zip.lua b/src/luarocks/tools/zip.lua index caeb4ac9..3afec53b 100644 --- a/src/luarocks/tools/zip.lua +++ b/src/luarocks/tools/zip.lua @@ -5,8 +5,6 @@ local zlib = require("zlib") local fs = require("luarocks.fs") local dir = require("luarocks.dir") -local size_buf = 65535 - local function number_to_bytestring(number, nbytes) local out = {} for i = 1, nbytes do @@ -115,8 +113,8 @@ local function zipwriter_add(self, file) err = "error opening "..file.." for reading" end end - while ok do - local buf = fin:read(size_buf) + if ok then + local buf = fin:read("*a") if not buf then break end -- cgit v1.2.3-55-g6feb From cf952ba5e16b7ac85c361db1333d86484ce4a47a Mon Sep 17 00:00:00 2001 From: Ignacio Burgueño Date: Wed, 29 Jun 2011 20:38:04 -0300 Subject: zip handle should be opened with 'wb' flags --- src/luarocks/tools/zip.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/luarocks/tools/zip.lua b/src/luarocks/tools/zip.lua index 3afec53b..36adc7e2 100644 --- a/src/luarocks/tools/zip.lua +++ b/src/luarocks/tools/zip.lua @@ -188,7 +188,7 @@ function new_zipwriter(name) local zw = {} - zw.ziphandle = io.open(name, "w") + zw.ziphandle = io.open(name, "wb") if not zw.ziphandle then return nil end -- cgit v1.2.3-55-g6feb