Commit 2b210b6f by Ian Lance Taylor

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
parent b685de12
...@@ -7,6 +7,7 @@ package rand ...@@ -7,6 +7,7 @@ package rand
import ( import (
"bytes" "bytes"
"compress/flate" "compress/flate"
"io"
"testing" "testing"
) )
...@@ -16,9 +17,9 @@ func TestRead(t *testing.T) { ...@@ -16,9 +17,9 @@ func TestRead(t *testing.T) {
n = 1e5 n = 1e5
} }
b := make([]byte, n) b := make([]byte, n)
n, err := Read(b) n, err := io.ReadFull(Reader, b)
if n != len(b) || err != nil { 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 var z bytes.Buffer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment