diff options
| author | cui fliter <imcusg@gmail.com> | 2022-09-30 03:41:42 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-10-02 02:27:38 +0000 |
| commit | 51297dd6df713b988b5c587e448b27d18ca1bd8a (patch) | |
| tree | c0eb9eba1a3eb81eada7df3b8be394a5ce6c5e2c /src/syscall/exec_libc.go | |
| parent | 5f566d35bf7d590c95f4d1b685b995deeb9ba957 (diff) | |
| download | go-51297dd6df713b988b5c587e448b27d18ca1bd8a.tar.xz | |
syscall: remove redundant type conversion
Change-Id: Iae290216687fd1ce8be720600157fb78cc2446d0
GitHub-Last-Rev: 4fba64ecb14a704d39f6ecc33989522bcac6656f
GitHub-Pull-Request: golang/go#55959
Reviewed-on: https://go-review.googlesource.com/c/go/+/436881
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/syscall/exec_libc.go')
| -rw-r--r-- | src/syscall/exec_libc.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/syscall/exec_libc.go b/src/syscall/exec_libc.go index 9e14197dcf..ef0c87e03c 100644 --- a/src/syscall/exec_libc.go +++ b/src/syscall/exec_libc.go @@ -215,7 +215,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr nextfd++ } for i = 0; i < len(fd); i++ { - if fd[i] >= 0 && fd[i] < int(i) { + if fd[i] >= 0 && fd[i] < i { if nextfd == pipe { // don't stomp on pipe nextfd++ } @@ -243,7 +243,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr closeFD(uintptr(i)) continue } - if fd[i] == int(i) { + if fd[i] == i { // dup2(i, i) won't clear close-on-exec flag on Linux, // probably not elsewhere either. _, err1 = fcntl1(uintptr(fd[i]), F_SETFD, 0) |
