Merge pull request 'libs: Make libmtar assert on version, make download close the connection' (#6) from Amanda/OC-PsychOS2:libs/minor-fixes into master

Reviewed-on: izaya/OC-PsychOS2#6
This commit was merged in pull request #6.
This commit is contained in:
2025-09-09 21:16:47 +10:00
2 changed files with 2 additions and 0 deletions
+1
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
+1
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))