Commit 61550910 authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

internal/syscall/unix: omit unnecessary randomTrap check in GetRandom

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: 's avatarIan Lance Taylor <iant@golang.org>
parent 75a0b9db
......@@ -28,9 +28,6 @@ const (
// 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
}
......
......@@ -26,9 +26,6 @@ const (
// 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
}
......
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