mirror of
https://github.com/vbatts/tar-split.git
synced 2024-12-18 19:46:29 +00:00
tar/asm: remove uneeded goroutine
Reported-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
parent
b607faf7f1
commit
ae13eaae94
1 changed files with 3 additions and 15 deletions
|
@ -74,23 +74,11 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
|
||||||
|
|
||||||
var csum []byte
|
var csum []byte
|
||||||
if hdr.Size > 0 {
|
if hdr.Size > 0 {
|
||||||
sumChan := make(chan []byte)
|
var err error
|
||||||
// if there is a file payload to write, then write the file to the FilePutter
|
_, csum, err = fp.Put(hdr.Name, tr)
|
||||||
fileRdr, fileWrtr := io.Pipe()
|
if err != nil {
|
||||||
go func() {
|
|
||||||
defer close(sumChan)
|
|
||||||
_, csum, err := fp.Put(hdr.Name, fileRdr)
|
|
||||||
if err != nil {
|
|
||||||
pW.CloseWithError(err)
|
|
||||||
}
|
|
||||||
sumChan <- csum
|
|
||||||
}()
|
|
||||||
if _, err = io.Copy(fileWrtr, tr); err != nil {
|
|
||||||
pW.CloseWithError(err)
|
pW.CloseWithError(err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
fileWrtr.Close()
|
|
||||||
csum = <-sumChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// File entries added, regardless of size
|
// File entries added, regardless of size
|
||||||
|
|
Loading…
Reference in a new issue