]> Cypherpunks repositories - gostls13.git/commit
syscall: forkAndExecInChild1: don't reuse pid variable
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 17 Jul 2025 03:32:10 +0000 (20:32 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 19 Aug 2025 15:26:46 +0000 (08:26 -0700)
commitc61db5ebd52a75af80da5afd2c2de3c6ddf080d2
tree7407170812de5c5ef81447209f93c7226c7f132c
parent07ee3bfc631cd6593c10b8715fc58b05d844f4ba
syscall: forkAndExecInChild1: don't reuse pid variable

A named return variable pid is reused in a few places, and while
the code is not wrong, it is somewhat confusing.

This variable used to be called r1 before CL 456516 (which did the right
thing, but slightly added to the confusion).

Now, the code calling SYS_WRITE (initially added by CL 158298) never
checks the number of bytes written, so let's remove the assignment.

In the code that calls SYS_READ it is used, so let's use a different
variable, c, which seems less confusing.

All this hopefully makes the code more readable.

Change-Id: I0d7ec311615100deb7e0aa3f02384eadcc1b47e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/696835
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/syscall/exec_linux.go