1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #39445 from lzhfromustc/master

ioutils: Fixed a potential data race in bytespipe
This commit is contained in:
Michael Crosby 2019-07-02 13:02:47 -04:00 committed by GitHub
commit a43a2ed746
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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