[flang-commits] [flang] [flang] use setsid to assign the child to prevent zombie as it will be clean up by init process (PR #77944)

David Truby via flang-commits flang-commits at lists.llvm.org
Tue Jan 16 08:15:12 PST 2024


================
@@ -191,6 +189,19 @@ void RTNAME(ExecuteCommandLine)(const Descriptor &command, bool wait,
         CheckAndCopyCharsToDescriptor(cmdmsg, "Fork failed");
       }
     } else if (pid == 0) {
+      // Create a new session, let init process take care of zombie child
+      if (setsid() == -1) {
+        if (!cmdstat) {
+          terminator.Crash("setsid() failed with errno: %d, asynchronous "
+                           "process initiation failed.",
+              errno);
----------------
DavidTruby wrote:

I guess this formatting comes from

https://github.com/llvm/llvm-project/pull/77944


More information about the flang-commits mailing list