mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #6320 from LK4D4/fix_stdcopy_eof
Don't exit on eof in header reading in stdcopy
This commit is contained in:
commit
4dcf4e9bd0
1 changed files with 5 additions and 4 deletions
|
@ -82,13 +82,14 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error)
|
|||
for nr < StdWriterPrefixLen {
|
||||
var nr2 int
|
||||
nr2, er = src.Read(buf[nr:])
|
||||
if er == io.EOF {
|
||||
return written, nil
|
||||
}
|
||||
if er != nil {
|
||||
// Don't exit on EOF, because we can have some more input
|
||||
if er != nil && er != io.EOF {
|
||||
return 0, er
|
||||
}
|
||||
nr += nr2
|
||||
if nr == 0 {
|
||||
return written, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Check the first byte to know where to write
|
||||
|
|
Loading…
Reference in a new issue