mirror of
https://github.com/golang/go
synced 2024-11-07 15:06:16 -07:00
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: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
75a0b9dbf3
commit
6155091042
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user