Fix CodeQL warning.
This commit is contained in:
parent
52cc8eb674
commit
f679cf4d7f
3 changed files with 6 additions and 2 deletions
2
go.sum
2
go.sum
|
@ -41,6 +41,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
|
||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
|
||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package zencmd
|
||||
|
||||
import (
|
||||
"math"
|
||||
"strconv"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
|
@ -11,7 +12,7 @@ type any = interface{}
|
|||
// ParseWindowId is internal.
|
||||
func ParseWindowId(id string) any {
|
||||
if pid, err := strconv.ParseUint(id, 0, 64); err == nil {
|
||||
return int(pid)
|
||||
return int(pid & math.MaxInt)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -14,7 +15,7 @@ import (
|
|||
// ParseWindowId is internal.
|
||||
func ParseWindowId(id string) int {
|
||||
wid, _ := strconv.ParseUint(id, 0, 64)
|
||||
return int(wid)
|
||||
return int(wid & math.MaxInt)
|
||||
}
|
||||
|
||||
// GetParentWindowId is internal.
|
||||
|
|
Loading…
Reference in a new issue