Przeglądaj źródła

Merge pull request #23317 from LK4D4/fix_bytepipe_race

ioutils: fix race in access closeErr in bytespipe
Antonio Murdaca 9 lat temu
rodzic
commit
3d80884f3d
1 zmienionych plików z 2 dodań i 1 usunięć
  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
 		}
 	}