The randomTrap const is initialized to a non-zero value for linux in
getrandom_linux_$GOARCH.go and for freebsd in getrandom_freebsd.go
directly since CL 16662. Thus, omit the unnecessary check.
Change-Id: Id20cd628dfe6fab9908fa5258c3132e3b422a6b4
Reviewed-on: https://go-review.googlesource.com/c/144108
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
// GetRandom calls the FreeBSD getrandom system call.
func GetRandom(p []byte, flags GetRandomFlag) (n int, err error) {
- if randomTrap == 0 {
- return 0, syscall.ENOSYS
- }
if len(p) == 0 {
return 0, nil
}
// GetRandom calls the Linux getrandom system call.
// See https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c6e9d6f38894798696f23c8084ca7edbf16ee895
func GetRandom(p []byte, flags GetRandomFlag) (n int, err error) {
- if randomTrap == 0 {
- return 0, syscall.ENOSYS
- }
if len(p) == 0 {
return 0, nil
}