aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2022-04-11 17:12:16 -0300
committerHisham Muhammad <hisham@gobolinux.org>2022-04-11 17:21:14 -0300
commitf1a09fe49db5ee123c3edd34aa88e8bb03231ede (patch)
tree945c75cb082880ecebbc6eb4f96a105aaacdc0b1
parent36f6fd122162c49fd1737344c1a9de7cc7bf3758 (diff)
downloadluarocks-f1a09fe49db5ee123c3edd34aa88e8bb03231ede.tar.gz
luarocks-f1a09fe49db5ee123c3edd34aa88e8bb03231ede.tar.bz2
luarocks-f1a09fe49db5ee123c3edd34aa88e8bb03231ede.zip
patch: fix check for malformed patches
-rw-r--r--src/luarocks/tools/patch.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/luarocks/tools/patch.lua b/src/luarocks/tools/patch.lua
index cc5293d3..6f36d713 100644
--- a/src/luarocks/tools/patch.lua
+++ b/src/luarocks/tools/patch.lua
@@ -540,7 +540,8 @@ local function write_new_file(filename, hunk)
540 local fh = io.open(filename, "wb") 540 local fh = io.open(filename, "wb")
541 if not fh then return false end 541 if not fh then return false end
542 for _, hline in ipairs(hunk.text) do 542 for _, hline in ipairs(hunk.text) do
543 if hline:sub(1,1) ~= "+" then 543 local c = hline:sub(1,1)
544 if c ~= "+" and c ~= "-" and c ~= " " then
544 return false, "malformed patch" 545 return false, "malformed patch"
545 end 546 end
546 fh:write(hline:sub(2)) 547 fh:write(hline:sub(2))