diff options
| author | Todd Neal <todd@tneal.org> | 2015-08-25 18:25:42 -0500 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2015-08-26 01:02:55 +0000 |
| commit | a94e906c41e83b663cd51751cbb74e801a54aba8 (patch) | |
| tree | d60ef1f48bff157c311240bafebd4b361f1704ee /src/runtime/sigqueue.go | |
| parent | af78482d6b1f7af7ec8339da6cf5fbbad95146bb (diff) | |
| download | go-a94e906c41e83b663cd51751cbb74e801a54aba8.tar.xz | |
runtime: remove always false comparison in sigsend
s is a uint32 and can never be zero. It's max value is already tested
against sig.wanted, whose size is derived from _NSIG. This also
matches the test in signal_enable.
Fixes #11282
Change-Id: I8eec9c7df8eb8682433616462fe51b264c092475
Reviewed-on: https://go-review.googlesource.com/13940
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/sigqueue.go')
| -rw-r--r-- | src/runtime/sigqueue.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/runtime/sigqueue.go b/src/runtime/sigqueue.go index 3f50a59c14..e6e1a84063 100644 --- a/src/runtime/sigqueue.go +++ b/src/runtime/sigqueue.go @@ -49,7 +49,7 @@ const ( // Reports whether the signal was sent. If not, the caller typically crashes the program. func sigsend(s uint32) bool { bit := uint32(1) << uint(s&31) - if !sig.inuse || s < 0 || int(s) >= 32*len(sig.wanted) || sig.wanted[s/32]&bit == 0 { + if !sig.inuse || s >= uint32(32*len(sig.wanted)) || sig.wanted[s/32]&bit == 0 { return false } @@ -137,7 +137,7 @@ func signal_enable(s uint32) { return } - if int(s) >= len(sig.wanted)*32 { + if s >= uint32(len(sig.wanted)*32) { return } sig.wanted[s/32] |= 1 << (s & 31) @@ -146,7 +146,7 @@ func signal_enable(s uint32) { // Must only be called from a single goroutine at a time. func signal_disable(s uint32) { - if int(s) >= len(sig.wanted)*32 { + if s >= uint32(len(sig.wanted)*32) { return } sig.wanted[s/32] &^= 1 << (s & 31) @@ -155,7 +155,7 @@ func signal_disable(s uint32) { // Must only be called from a single goroutine at a time. func signal_ignore(s uint32) { - if int(s) >= len(sig.wanted)*32 { + if s >= uint32(len(sig.wanted)*32) { return } sig.wanted[s/32] &^= 1 << (s & 31) |
