Don't exit on eof in header reading in stdcopy

There was random lines drops in docker logs because of this
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Upstream-commit: b1bae925341f45736fcafaeaf8c75274e9ad4305
Component: engine
This commit is contained in:
Alexandr Morozov
2014-06-09 16:28:32 +04:00
parent b71d34e96b
commit 6c57622b2a

View File

@ -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