]> Cypherpunks repositories - gostls13.git/commitdiff
internal/syscall/unix: omit unnecessary randomTrap check in GetRandom
authorTobias Klauser <tklauser@distanz.ch>
Wed, 24 Oct 2018 11:32:24 +0000 (13:32 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Wed, 24 Oct 2018 13:43:00 +0000 (13:43 +0000)
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>
src/internal/syscall/unix/getrandom_freebsd.go
src/internal/syscall/unix/getrandom_linux.go

index fc241f23457c22ade728059af41fb429065224dd..f1ba5730c96953281b37c276d307aac548bf12da 100644 (file)
@@ -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
        }
index 0d0d4f115c03516069c582bcd1cac4b7c35a45c0..00d8110f6fc6b0cc1cf5373043a1d958d61ae6c2 100644 (file)
@@ -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
        }