From a6496e5b41bf44e012d81067f122fc5836008ed2 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Mon, 6 Jun 2016 11:29:47 -0700 Subject: [PATCH] ioutils: fix race in access closeErr in bytespipe Signed-off-by: Alexander Morozov --- ioutils/bytespipe.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ioutils/bytespipe.go b/ioutils/bytespipe.go index eca129b..72a04f3 100644 --- a/ioutils/bytespipe.go +++ b/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 } }