Explorar o código

Merge pull request #23317 from LK4D4/fix_bytepipe_race

ioutils: fix race in access closeErr in bytespipe
Antonio Murdaca %!s(int64=9) %!d(string=hai) anos
pai
achega
3d80884f3d
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      pkg/ioutils/bytespipe.go

+ 2 - 1
pkg/ioutils/bytespipe.go

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