From b1bae925341f45736fcafaeaf8c75274e9ad4305 Mon Sep 17 00:00:00 2001 From: Alexandr Morozov Date: Mon, 9 Jun 2014 16:28:32 +0400 Subject: [PATCH] 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 (github: LK4D4) --- utils/stdcopy.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/utils/stdcopy.go b/utils/stdcopy.go index 8b43386140..ab8759f4ee 100644 --- a/utils/stdcopy.go +++ b/utils/stdcopy.go @@ -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