1
0
Fork 1
mirror of https://github.com/vbatts/tar-split.git synced 2024-12-22 05:16:32 +00:00

Correctly handle Read returning (0, nil)

It's not an EOF indication.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač 2023-07-22 02:35:45 +02:00
parent 9982e470fa
commit cd197d3076

View file

@ -135,16 +135,15 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
} }
isEOF = true isEOF = true
} }
if n == 0 { if n != 0 {
break _, err = p.AddEntry(storage.Entry{
} Type: storage.SegmentType,
_, err = p.AddEntry(storage.Entry{ Payload: paddingChunk[:n],
Type: storage.SegmentType, })
Payload: paddingChunk[:n], if err != nil {
}) pW.CloseWithError(err)
if err != nil { return
pW.CloseWithError(err) }
return
} }
if isEOF { if isEOF {
break break