ioutils: fix race in access closeErr in bytespipe

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov 2016-06-06 11:29:47 -07:00
parent 7ee212504d
commit a6496e5b41

View file

@ -133,8 +133,9 @@ func (bp *BytesPipe) Read(p []byte) (n int, err error) {
} }
bp.wait.Wait() bp.wait.Wait()
if bp.bufLen == 0 && bp.closeErr != nil { if bp.bufLen == 0 && bp.closeErr != nil {
err := bp.closeErr
bp.mu.Unlock() bp.mu.Unlock()
return 0, bp.closeErr return 0, err
} }
} }