re PR go/52341 (crypto/rand FAILs before Solaris 11)

PR go/52341

crypto/rand: Use io.ReadFull when reading from /dev/urandom.

From-SVN: r186803
This commit is contained in:
Ian Lance Taylor 2012-04-25 04:40:49 +00:00
parent b685de12d2
commit 2b210b6f0b
1 changed files with 3 additions and 2 deletions

View File

@ -7,6 +7,7 @@ package rand
import (
"bytes"
"compress/flate"
"io"
"testing"
)
@ -16,9 +17,9 @@ func TestRead(t *testing.T) {
n = 1e5
}
b := make([]byte, n)
n, err := Read(b)
n, err := io.ReadFull(Reader, b)
if n != len(b) || err != nil {
t.Fatalf("Read(buf) = %d, %s", n, err)
t.Fatalf("ReadFull(buf) = %d, %s", n, err)
}
var z bytes.Buffer