Skip to content

Commit

Permalink
Correctly handle Read returning (0, nil)
Browse files Browse the repository at this point in the history
It's not an EOF indication.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
  • Loading branch information
mtrmac committed Jul 22, 2023
1 parent 9982e47 commit cd197d3
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions tar/asm/disassemble.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,15 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
}
isEOF = true
}
if n == 0 {
break
}
_, err = p.AddEntry(storage.Entry{
Type: storage.SegmentType,
Payload: paddingChunk[:n],
})
if err != nil {
pW.CloseWithError(err)
return
if n != 0 {
_, err = p.AddEntry(storage.Entry{
Type: storage.SegmentType,
Payload: paddingChunk[:n],
})
if err != nil {
pW.CloseWithError(err)
return
}
}
if isEOF {
break
Expand Down

0 comments on commit cd197d3

Please sign in to comment.