1
1
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:
Amanda Cameron 2025-09-08 12:45:51 +00:00
parent 1c647c76fe
commit 6c7a8d4c61
2 changed files with 2 additions and 0 deletions

View File

@ -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

View File

@ -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))