From 6fb76e6522ef5ccb96d02445ffa39796dae89016 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 21 Aug 2018 07:53:03 +0000 Subject: [PATCH] further refactoring --- src/crypto/rand/rand_batched.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/rand/rand_batched.go b/src/crypto/rand/rand_batched.go index 63ef762719..60267fd4bc 100644 --- a/src/crypto/rand/rand_batched.go +++ b/src/crypto/rand/rand_batched.go @@ -12,7 +12,7 @@ import ( // maxGetRandomRead is platform dependent. func init() { - altGetRandom = batched(getRandomLinux, maxGetRandomRead) + altGetRandom = batched(getRandomBatch, maxGetRandomRead) } // batched returns a function that calls f to populate a []byte by chunking it @@ -36,7 +36,7 @@ func batched(f func([]byte) bool, readMax int) func([]byte) bool { // If the kernel supports the getrandom() syscall, unix.GetRandom will block // until the kernel has sufficient randomness (as we don't use GRND_NONBLOCK). // In this case, unix.GetRandom will not return an error. -func getRandomLinux(p []byte) (ok bool) { +func getRandomBatch(p []byte) (ok bool) { n, err := unix.GetRandom(p, 0) return n == len(p) && err == nil }