forked from mirrors/tar-split
tar/asm: clean up return on errors
This closure on error message needs returns so that the error message is bubbled up to the reader.
This commit is contained in:
parent
d3556a0551
commit
6d59e7bc76
1 changed files with 8 additions and 2 deletions
|
@ -61,6 +61,7 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pW.CloseWithError(err)
|
pW.CloseWithError(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
break // not return. We need the end of the reader.
|
break // not return. We need the end of the reader.
|
||||||
}
|
}
|
||||||
|
@ -73,6 +74,7 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
|
||||||
Payload: tr.RawBytes(),
|
Payload: tr.RawBytes(),
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
pW.CloseWithError(err)
|
pW.CloseWithError(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var csum []byte
|
var csum []byte
|
||||||
|
@ -81,6 +83,7 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
|
||||||
_, csum, err = fp.Put(hdr.Name, tr)
|
_, csum, err = fp.Put(hdr.Name, tr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pW.CloseWithError(err)
|
pW.CloseWithError(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +96,7 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pW.CloseWithError(err)
|
pW.CloseWithError(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if b := tr.RawBytes(); len(b) > 0 {
|
if b := tr.RawBytes(); len(b) > 0 {
|
||||||
|
@ -102,6 +106,7 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pW.CloseWithError(err)
|
pW.CloseWithError(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +116,7 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
|
||||||
remainder, err := ioutil.ReadAll(outputRdr)
|
remainder, err := ioutil.ReadAll(outputRdr)
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
pW.CloseWithError(err)
|
pW.CloseWithError(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
_, err = p.AddEntry(storage.Entry{
|
_, err = p.AddEntry(storage.Entry{
|
||||||
Type: storage.SegmentType,
|
Type: storage.SegmentType,
|
||||||
|
@ -118,9 +124,9 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pW.CloseWithError(err)
|
pW.CloseWithError(err)
|
||||||
} else {
|
return
|
||||||
pW.Close()
|
|
||||||
}
|
}
|
||||||
|
pW.Close()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return pR, nil
|
return pR, nil
|
||||||
|
|
Loading…
Reference in a new issue