mirror of
https://git.shadowkat.net/izaya/OC-PsychOS2.git
synced 2026-01-08 23:42:28 -05:00
libs: Make libmtar assert on version, make download close the connection
This commit is contained in:
parent
1c647c76fe
commit
6c7a8d4c61
@ -110,6 +110,7 @@ function dl.protos.http(host, optPort, path, dest, url) -- string string string
|
||||
ns = R.read()
|
||||
f:write(ns or "")
|
||||
until not ns
|
||||
R.close()
|
||||
f:close()
|
||||
print("Done.")
|
||||
return true
|
||||
|
||||
@ -38,6 +38,7 @@ function mtar.iter(stream) -- table -- function -- Given buffer *stream*, return
|
||||
return
|
||||
elseif nlen == 65535 then -- versioned header
|
||||
version = string.byte(stream:read(1))
|
||||
assert(versions[version], "Unknown version: " .. version)
|
||||
nlen = string.unpack(versions[version].nlf, stream:read(string.packsize(versions[version].nlf)))
|
||||
end
|
||||
local name = cleanPath(stream:read(nlen))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user