summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pkg/io/pipe.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pkg/io/pipe.go b/src/pkg/io/pipe.go
index 79221bd49..898526921 100644
--- a/src/pkg/io/pipe.go
+++ b/src/pkg/io/pipe.go
@@ -144,10 +144,11 @@ func (p *pipeHalf) rw(data []byte) (n int, err os.Error) {
// Run i/o operation.
// Check ioclosed flag under lock to make sure we're still allowed to do i/o.
p.io.Lock()
- defer p.io.Unlock()
if p.ioclosed {
+ p.io.Unlock()
return 0, os.EINVAL
}
+ p.io.Unlock()
p.c1 <- data
res := <-p.c2
return res.n, res.err