From: Ian Lance Taylor Date: Tue, 7 Jul 2009 17:15:01 +0000 (-0700) Subject: Avoid race condition. Following the left to right rule, X-Git-Tag: weekly.2009-11-06~1236 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5abf395be71e40621d17c6dc5a07aca9ffb5c734;p=gostls13.git Avoid race condition. Following the left to right rule, s.output.Data() was being retrieved before the synchronization point, which meant that it could be retrieved before the goroutine wrote it. Using gccgo this caused random errors. R=gri DELTA=2 (1 added, 0 deleted, 1 changed) OCL=31046 CL=31267 --- diff --git a/src/pkg/datafmt/datafmt.go b/src/pkg/datafmt/datafmt.go index 48c24e7264..96dc1d743d 100644 --- a/src/pkg/datafmt/datafmt.go +++ b/src/pkg/datafmt/datafmt.go @@ -745,7 +745,8 @@ func (f Format) Eval(env Environment, args ...) ([]byte, os.Error) { errors <- nil; // no errors }(); - return s.output.Data(), <- errors; + err := <- errors; + return s.output.Data(), err; }