Skip to content

Commit 1765627

Browse files
committed
Fixed a bug where patching an empty file would falsely report as malformed.
1 parent 6f803a5 commit 1765627

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xtra/PATCH.LUA

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ local function patch(pf)
1414
o,e=io.open(f,"w")if not o then return abort()end
1515
b,e=io.open(f..".orig")if not b then return abort()end
1616
if of then of:close()end if bf then bf:close()end of,ol,bf,bl,h=o,0,b,0,nil return true end
17-
local function writeRemainder()if h then if h.o.l~=bl-(h.o.s-1)or h.n.l~=ol-(h.n.s-1)then print(M)os.exit(1)else print("patched")end end
17+
local function writeRemainder()if h then if(h.o.l>0 and h.o.s>0)and(h.o.l~=bl-(h.o.s-1)or h.n.l~=ol-(h.n.s-1))then print(M)os.exit(1)else print("patched")end end
1818
if of then local rest=bf:read("*l")while rest do of:write(rest..'\n')rest=bf:read("*l")end of:close()of,ol=nil,0 end bf:close()bf,bl,h=nil,0,nil end
1919
local n=pf:read("*l")while n do
2020
local l,ls=n n=pf:read("*l")ls=l:sub(1,1)

0 commit comments

Comments
 (0)