init: Reduce the number of system calls

Change setpgid(0, getpid()) into setpgid(0, 0). This patch removes one
system call but does not change the behavior of the code. From the
setpgid() man page: "If pgid is zero, then the PGID of the process
specified by pid is made the same as its process ID."

Bug: 213617178
Change-Id: I7031d9eb3711f526751da495c07a8927f9386d97
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Bart Van Assche 2022-11-18 09:45:33 -08:00
parent 41787239ec
commit d394f74365
1 changed files with 1 additions and 1 deletions

View File

@ -244,7 +244,7 @@ Result<void> SetProcessAttributes(const ProcessAttributes& attr) {
setsid();
OpenConsole(attr.console);
} else {
if (setpgid(0, getpid()) == -1) {
if (setpgid(0, 0) == -1) {
return ErrnoError() << "setpgid failed";
}
SetupStdio(attr.stdio_to_kmsg);