Revert "init: Fix a race condition in KillProcessGroup()"
This reverts commit 15e5ecdcd7ea69e63387346bd235fbeb3e3597df.
Reason for revert: breaks console support.
Bug: 213617178
Bug: 258754901
Change-Id: Iffe213e2cd295461a427621f2b84933f1bebd39f
diff --git a/init/service_utils.cpp b/init/service_utils.cpp
index 9585d05..a14969e 100644
--- a/init/service_utils.cpp
+++ b/init/service_utils.cpp
@@ -240,15 +240,11 @@
}
}
- if (RequiresConsole(attr)) {
+ if (!attr.console.empty()) {
setsid();
OpenConsole(attr.console);
} else {
- // Without PID namespaces, this call duplicates the setpgid() call from
- // the parent process. With PID namespaces, this setpgid() call sets the
- // process group ID for a child of the init process in the PID
- // namespace.
- if (setpgid(0, 0) == -1) {
+ if (setpgid(0, getpid()) == -1) {
return ErrnoError() << "setpgid failed";
}
SetupStdio(attr.stdio_to_kmsg);